Files
speckle-server/packages/server/modules/shared/helpers/cryptoHelper.ts
T
2022-08-24 13:46:24 +03:00

19 lines
431 B
TypeScript

import crypto from 'crypto'
export function md5(val: string): string {
return crypto
.createHash('md5')
.update(val || '')
.digest('hex')
}
export function base64Encode(val: string): string {
const bufferObj = Buffer.from(val, 'utf8')
return bufferObj.toString('base64')
}
export function base64Decode(val: string): string {
const bufferObj = Buffer.from(val, 'base64')
return bufferObj.toString('utf8')
}