char-fork/llama.cpp
git clone https://git.t4t.associates/char-fork/llama.cpp
ed1c3a20f
char/aliceai-t5-moe
1#include "hash.h" 2 3extern "C" { 4#include "sha256/sha256.h" 5} 6 7static std::string to_hex (const unsigned char * digest ,size_t len ) { 8static const char hex []= "0123456789abcdef" ; 9 10 std::string out ; 11out .reserve (2 * len ); 12for (size_t i = 0 ;i < len ;++ i ) { 13out += hex [digest [i ] >>4 ]; 14out += hex [digest [i ]& 0xf ]; 15 } 16return out ; 17} 18 19std::string hash_sha256_hex (const void * data ,size_t len ) { 20unsigned char digest [SHA256_DIGEST_SIZE ]; 21sha256_hash (digest , (const unsigned char * )data ,len ); 22return to_hex (digest ,SHA256_DIGEST_SIZE ); 23}