1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2025-12-14 10:41:52 +00:00
tobspr_shapez.io/src/js/core/sensitive_utils.encrypt.js

13 lines
291 B
JavaScript
Raw Normal View History

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