ereon / csodium Goto Github PK
View Code? Open in Web Editor NEWA standalone libsodium interface.
License: GNU General Public License v3.0
A standalone libsodium interface.
License: GNU General Public License v3.0
Asserts may not be the best to catch length mismatches.
Maybe:
Convert length errors to ValueErrors
_raise_on_error raise a more specific error (like SodiumError?)
Possibly a special error for open and verify failures
cffi 1.8.3 cares about the distinction between char and unsigned char and raises a warning now. This seems to be caused by the ffi.from_buffer()
. Replacing with the following seems to suprress the warning:
ffi.cast("unsigned char *", ffi.from_buffer())
libsodium provides a mechanism for secure memory. However, they are expensive. They are much slower than a standard malloc. They also allocate 3-4 pages of memory (12kb-16kb) per call. Plus, most os have a limit on the amount of memory that can be locked.
Since secure memory is so expensive, I don't think we can use it for all allocations. One option is to pass output buffers to the functions:
def crypto_box_keypair(pk_out=None, sk_out=None):
if pk_out is None:
pk_out = bytearray(crypto_box_PUBLICKEYBYTES)
else:
_assert_len('pk_out', pk_out, crypto_box_PUBLICKEYBYTES)
But this would change the current API.
What are your thoughts? Is it worth it?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.