[Closes #55] Generate predictable MAC address (but avoid sneaky data leakage)

This commit is contained in:
Casper Warden
2022-04-19 16:12:21 +01:00
parent 2104e03b40
commit 12b11b4b52
5 changed files with 81 additions and 88 deletions

View File

@@ -12,6 +12,7 @@ import { GlobalPosition } from './public/interfaces/GlobalPosition';
import { Quaternion } from './Quaternion';
import { Vector3 } from './Vector3';
import Timeout = NodeJS.Timeout;
import * as crypto from 'crypto';
export class Utils
{
@@ -28,6 +29,11 @@ export class Utils
return Buffer.from(str + '\0', 'utf8');
}
static SHA1String(str: string): string
{
return crypto.createHash('sha1').update(str).digest('hex');
}
static BufferToStringSimple(buf: Buffer): string
{
if (buf.length === 0)