[Closes #55] Generate predictable MAC address (but avoid sneaky data leakage)
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user