1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2025-12-13 18:21:51 +00:00
tobspr_shapez.io/src/js/core/sensitive_utils.encrypt.js
Даниїл Григор'єв 67f7babd09
Drop support for SHA1 checksums
Also remove an unused function and switch to crypto.randomUUID() for
savegame ID generation.
2024-07-26 18:01:38 +03:00

13 lines
291 B
JavaScript

import crc32 from "crc/crc32";
// Distinguish legacy crc prefixes
export const CRC_PREFIX = "crc32".padEnd(32, "-");
/**
* Computes the crc for a given string
* @param {string} str
*/
export function computeCrc(str) {
return CRC_PREFIX + crc32(str).toString(16).padStart(8, "0");
}