etcimon / botan

Block & stream ciphers, public key crypto, hashing, KDF, MAC, PKCS, TLS, ASN.1, BER/DER, etc.
Other
85 stars 22 forks source link

Phobos compatibe? #4

Closed Abscissa closed 1 year ago

Abscissa commented 9 years ago

Are the hashing and random algorithms in this library compatible with the hashing and random interfaces defined in Phobos? Ie, std.digest.digest.isDigest and std.random.isUniformRNG. If not, can Phobos-compatible wrappers be added?

etcimon commented 9 years ago

I think my programs/libraries in general have diverged a little too far from Phobos' reach, due to the thread-local nature and because this was a direct translation of the C++ library. I'm a big fan of non-locking solutions. You'll probably get lots of Invalid Memory Operations when you escape anything from Botan into the current GC.... until a thread-local GC is merged: https://github.com/etcimon/druntime/commit/7da3939637bd1642400dbed83e3b0ff2844386ac

So, any wrapper that is based on Botan needs to consider this. Until then, I guess all you could do is learn to use the BufferedComputation interface and generate your crypto using the libstate :) And learn to use Unique!T or to destroy any objects manually.