diff --git a/src/backend/utils/crypto.ts b/src/backend/utils/crypto.ts index 39b60c6..6782a9a 100644 --- a/src/backend/utils/crypto.ts +++ b/src/backend/utils/crypto.ts @@ -1,15 +1,5 @@ import crypto from 'crypto'; -/** - * - * @param {string} hexStr - input hex string - * @returns {string} - output binary string - */ -function hexToBinary(hexStr: string): string { - return (parseInt(hexStr, 16).toString(2)) - .padStart(8, '0'); -} - /** * Create binary md5 * @@ -17,9 +7,10 @@ function hexToBinary(hexStr: string): string { * @returns {string} - binary hash of argument */ export function binaryMD5(stringToHash: string): string { - return hexToBinary(crypto.createHash('md5') + return crypto.createHash('md5') .update(stringToHash) - .digest('hex')); + .digest() + .toString('binary'); } /**