const char *sha(const char *in, size_t len)
{
static char h[32];
- sha256(h, in, len);
+ d0_blind_id_util_sha256(h, in, len);
return h;
}
d0_blind_id_clear(a);
d0_free(a);
}
+
+void d0_blind_id_util_sha256(char *out, const char *in, size_t n)
+{
+ SHA256_CTX context;
+ SHA256_Init(&context);
+ SHA256_Update(&context, (const unsigned char *) in, n);
+ return SHA256_Final((unsigned char *) out, &context);
+}
EXPORT void d0_blind_id_INITIALIZE(void);
EXPORT void d0_blind_id_SHUTDOWN(void);
+EXPORT void d0_blind_id_util_sha256(char *out, const char *in, size_t n);
+
#endif
SHA384_Update(&context, data, len);
return SHA384_End(&context, digest);
}
-
-
-
-
-
-void sha256(unsigned char *out, const unsigned char *in, int n)
-{
- SHA256_CTX context;
- SHA256_Init(&context);
- SHA256_Update(&context, in, n);
- return SHA256_Final(out, &context);
-}
char* SHA512_End(SHA512_CTX*, char[SHA512_DIGEST_STRING_LENGTH]);
char* SHA512_Data(const uint8_t*, size_t, char[SHA512_DIGEST_STRING_LENGTH]);
-void sha256(unsigned char *out, const unsigned char *in, int n);
-
#else /* SHA2_USE_INTTYPES_H */
void SHA256_Init(SHA256_CTX *);