Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Special characters in encryption key - different output #209

Open
TheTrunk opened this issue Nov 4, 2021 · 0 comments
Open

Special characters in encryption key - different output #209

TheTrunk opened this issue Nov 4, 2021 · 0 comments

Comments

@TheTrunk
Copy link

TheTrunk commented Nov 4, 2021

Using special language native characters in encryption key result in different crypted phrase compared to native crypto node module.
Example of characters: ěščřžýáíéśćżź and way more.

Reproduction code:

    const crypto = require("crypto");
    const cryptoBrowser = require("crypto-browserify");
    const algorithm = "aes-256-ctr";
    const encryptionkey = "asdasdasdsadś gqwfwqrn";

    const encrypt = crypto.createCipher(algorithm, encryptionkey);
    let crypted = encrypt.update("123456781234565", "utf8", "hex");
    crypted += encrypt.final("hex");
    console.log(crypted); // 49a45f088f2c47cc91d62ac5290eaa

    const encryptB = cryptoBrowser.createCipher(algorithm, encryptionkey);
    let cryptedB = encryptB.update("123456781234565", "utf8", "hex");
    cryptedB += encryptB.final("hex");
    console.log(cryptedB); // 97a55dbe16a6fad4930e8122a0b554

Thank you for explanation and more insight into why it is happening and how to resolve it in case I want to have these special characters in encryption key.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant