mirror of
https://github.com/tobspr/shapez.io.git
synced 2025-12-13 18:21:51 +00:00
Also remove an unused function and switch to crypto.randomUUID() for savegame ID generation.
13 lines
291 B
JavaScript
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");
|
|
}
|