Giter VIP home page Giter VIP logo

Comments (6)

transmissions11 avatar transmissions11 commented on June 2, 2024 1

@danang-id Thanks for all your hard work, and thanks for being so quick to respond. Closing this PR as no further work needs to be done. 👍

from simple-crypto-js.

danang-id avatar danang-id commented on June 2, 2024

Yup, this is come after 2.4.0 update with the assumption that empty string is not subject to encryption. I could agree to disable empty string check. As the goals of this library is to be simple, I don't see an optional configuration is coming.

Beside that snippet you provide, empty string check happens 3 times here.

if (data === void 0 || data === null || data === "") {

if (this._dataBuffer === "") {
throw new Error("No data was provided to be decrypted. Decryption halted.")
}

if (this._dataBuffer === "") {
throw new Error("No data was provided to be encrypted. Encryption halted.")
}

You may, if you wish, provide a PR to remove empty string check.

from simple-crypto-js.

transmissions11 avatar transmissions11 commented on June 2, 2024

@danang-id Thank you! PR coming shortly. 😁

from simple-crypto-js.

transmissions11 avatar transmissions11 commented on June 2, 2024

@danang-id As I began working on this PR i noticed that this snippet you linked me:

if (this._dataBuffer === "") {
throw new Error("No data was provided to be decrypted. Decryption halted.")
}

This snippet isn't validating whether a plain string is empty, but whether the cypher text is empty. I don't think I should remove this, correct?

from simple-crypto-js.

danang-id avatar danang-id commented on June 2, 2024

Merged PR #22

from simple-crypto-js.

danang-id avatar danang-id commented on June 2, 2024

This snippet isn't validating whether a plain string is empty, but whether the cypher text is empty. I don't think I should remove this, correct?

@TransmissionsDev The empty string check of _dataBuffer in _decrypt() is actually useless because of the _dataBuffer length check that happens after the empty string check.

if (this._dataBuffer.length <= 64) {
throw new Error("Invalid cipher text. Decryption halted.")
}

The empty string check on _decrypt() will also be removed.

from simple-crypto-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.