Visitar URL original
Special characters in encryption key - different output · Issue #209 · browserify/crypto-browserify · GitHub
Skip to content

Special characters in encryption key - different output  #209

Open

Description

@TheTrunk

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions