GithubHelp home page GithubHelp logo

Key Length issue about encrypt HOT 2 CLOSED

leocavalcante avatar leocavalcante commented on June 30, 2024
Key Length issue

from encrypt.

Comments (2)

leocavalcante avatar leocavalcante commented on June 30, 2024 1

Hi @NTMS2017
This is a constraint of the algorithm: https://en.wikipedia.org/wiki/Advanced_Encryption_Standard
Keys must be 128, 192 or 256 bits, exactly this sizes, it's not a range.

As you researched, 1 utf-8 char is 4 bytes, so a 32 char length key is equals to 32 * 4 = 128 bits.

So keys should have:

UTF-8 length Bits
32 128
48 192
64 256

This can vary on the characters you are using

I highly recommend you to use a 256 bits key generated by a CSPRNG. PointyCastle has one, it is used for the Salts in password.

I will stick your issue to remember to add something like that in this project so you can generate cryptographic secure keys right from the terminal.

Note: You already able to do that thought /dev/urandom or RtlGenRandom.

from encrypt.

NTMS2017 avatar NTMS2017 commented on June 30, 2024

Thanks Leo, check all this tomorrow.

from encrypt.

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.