Comments (4)
By tricky you mean inconvenient I presume? :)
The situation is as following:
- The library works (as virtually any C library) on bytes. I can’t know what encoding your secrets are in (because it can be any byte, not just readable/printable ones). Trying to guess that in a security context like this, is a road to security vulnerabilities.
hash_password_raw()
also has to return bytes because it does. There’s no applicable encoding.
On the other hand, the encoded hash is always ASCII bytes, therefore I could easily encode/decode it.
But I’ve decided for the sake of:
- simplicity/symmetry (any string is bytes, you don’t have to think about it),
- performance (I still have to pass in bytes and I still get back bytes. if the user doesn't want unicode, there's an extra encoding/decoding round which puts you at a disadvantage to the attacker).
to keep it as bytes too.
As you can see, supporting Unicode would force me to make decisions for the users. In my other libraries I’m usually happy to do so (opinionated software tends to be better software), but this one is a) security-related and b) rather low-level since it’s the direct C-wrapper.
So, at this point we can decide to build higher-level helpers that presume that you always want your Unicode secrets interpreted as UTF-8 when going in and decoded when coming out. Maybe I’ll add something like that at some point, but for know I’d encourage you to build your own simple helpers (which also may contain your parameters?) until clearer usage patterns emerge.
I think I’ll start an FAQ with this. :)
from argon2-cffi.
Thanks for the explanation hynek! I really appreciate it.
from argon2-cffi.
Does http://argon2-cffi.readthedocs.org/en/latest/api.html#module-argon2 do what you need?
from argon2-cffi.
Yes!!! LOL
Thanks a lot!!
from argon2-cffi.
Related Issues (20)
- RFC is no longer a draft (RFC9106); default parameter choice out of date HOT 4
- 21.2.0: pep517 does not build cython modules HOT 6
- 21.1.0: `notebook` test suite is crashing with SIGILL in _cffi_backend.cpython.*so DSO HOT 11
- Inconsistent advice for key derivation HOT 5
- How to avoid timing attacks? HOT 1
- hash function return + / verify issue with sqlite HOT 3
- Question: Can output from argon2.low_level.hash_secret_raw() → bytes directly used to derive aes key? HOT 3
- Associated data cannot be specified in the low_level functions HOT 10
- Support password verification without sending the password from client to server HOT 5
- Make hash verification return True or False HOT 4
- Second salt HOT 1
- hash() got an unexpected keyword argument 'salt' HOT 1
- would a python-3.9 wheel be possible ? HOT 13
- seems missing _ffi.abi3.so when pip installing in docker HOT 7
- Failed Source Build on Apple Silicon HOT 9
- Wheel support for linux aarch64 HOT 4
- Unable to install on Xavier NX HOT 1
- Fail to install by pip on macOS 11.0.1 Big Sur HOT 11
- 20.1.0: sphinx warnings HOT 4
- 20.1.0: pytest warnings HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from argon2-cffi.