mirror of
https://github.com/certd/certd.git
synced 2025-11-25 09:10:11 +08:00
perf: 支持部署到天翼云CDN
This commit is contained in:
@@ -7,6 +7,10 @@ function sha256(data: string, digest: BinaryToTextEncoding = 'hex') {
|
||||
return crypto.createHash('sha256').update(data).digest(digest);
|
||||
}
|
||||
|
||||
function HmacSha256(data: string, key: string, digest: BinaryToTextEncoding = 'base64') {
|
||||
return crypto.createHmac('sha256', Buffer.from(key, 'base64')).update(data).digest(digest);
|
||||
}
|
||||
|
||||
function base64(data: string) {
|
||||
return Buffer.from(data).toString('base64');
|
||||
}
|
||||
@@ -14,4 +18,5 @@ export const hashUtils = {
|
||||
md5,
|
||||
sha256,
|
||||
base64,
|
||||
HmacSha256,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user