对于在C中生成SHA1密钥,我可以使用:
// The data to be hashed
char data[] = "Hello, world!";
size_t length = sizeof(data);
unsigned char hash[SHA_DIGEST_LENGTH];
SHA1(data, length, hash);
// hash now contains the 20-byte SHA-1 hash
如下所述:https://stackoverflow.com/a/9284520/3019006
我想在Java中生成相同的密钥,以便在输入相同数据时两个密钥匹配。我该怎么用?