Good evening!
I've been looking for an alternate project to intel_extreme to keep me from
getting
burnt out with the hardware stuff.
Introducing the "crypto kit". A set of Haiku-provided encryption and hashing
APIs.
https://github.com/kallisti5/haiku/blob/crypto/headers/os/crypto/CryptoHash.h
Pretty much a an API for doing crypto-related tasks like hashing and two-way
encryption.
Here is a quick demo of BCryptoHash using the BLAKE2 hash:
/Builds/haiku-fork> cat ~/test.cpp
#include <CryptoHash.h>
#include <stdio.h>
int
main()
{
char text[12] = "helloworld!";
BCryptoHash* hashAPI = new BCryptoHash(B_HASH_BLAKE2);
if (!hashAPI->Ready()) {
delete hashAPI;
return 1;
}
BString result = hashAPI->Hash(text, 11);
printf("Result: %s\n", result.String());
delete hashAPI;
return 0;
}
/Builds/haiku-fork> gcc ~/test.cpp -g -I /Builds/haiku-fork/headers/os/crypto/
-lstdc++ -lbe -lbcrypto -L ~/config/non-packaged/lib/
/Builds/haiku-fork> ./a.out
Hash: Position: 0
Result:
5bd0573432b3850d36d73b414c5dc393a62c0dcaa22ef2183d16807608d94e24bfe76b9488f0f730d225a6885fdbf5f6f9e734b7eb918a867e57ad12ae9c125e
Compare to the "real" blake2 hashing algorithm code on Linux:
b2sum :) $ echo -n "helloworld!" | ./b2sum -a blake2b
5bd0573432b3850d36d73b414c5dc393a62c0dcaa22ef2183d16807608d94e24bfe76b9488f0f730d225a6885fdbf5f6f9e734b7eb918a867e57ad12ae9c125e
-
Feedback *highly* welcome.
I've only invested a day or so into it... so if everyone hates the idea it's no
big deal :-)
-- Alex