diff --git a/modules/septima-lang/src/runtime.ts b/modules/septima-lang/src/runtime.ts index 359ba9ef..2131d6d5 100644 --- a/modules/septima-lang/src/runtime.ts +++ b/modules/septima-lang/src/runtime.ts @@ -99,7 +99,7 @@ export class Runtime { }) const parse = Value.foreign(o => JSON.parse(o.toString())) - const hash = Value.foreign(o => crypto.createHash('sha224').update(JSON.stringify(o.unwrap())).digest('hex')) + const hash224 = Value.foreign(o => crypto.createHash('sha224').update(JSON.stringify(o.unwrap())).digest('hex')) let lib = new SymbolFrame('Object', { destination: Value.obj({ keys, entries, fromEntries }) }, empty, 'INTERNAL') lib = new SymbolFrame('String', { destination: Value.foreign(o => Value.str(o.toString())) }, lib, 'INTERNAL') @@ -108,7 +108,7 @@ export class Runtime { lib = new SymbolFrame('Array', { destination: Value.obj({ isArray }) }, lib, 'INTERNAL') lib = new SymbolFrame('console', { destination: Value.obj({ log }) }, lib, 'INTERNAL') lib = new SymbolFrame('JSON', { destination: Value.obj({ parse }) }, lib, 'INTERNAL') - lib = new SymbolFrame('crypto', { destination: Value.obj({ hash }) }, lib, 'INTERNAL') + lib = new SymbolFrame('crypto', { destination: Value.obj({ hash224 }) }, lib, 'INTERNAL') if (generateTheArgsObject) { lib = new SymbolFrame('args', { destination: Value.from(this.args) }, lib, 'INTERNAL') diff --git a/modules/septima-lang/tests/septima.spec.ts b/modules/septima-lang/tests/septima.spec.ts index 74c6397d..fe33d60f 100644 --- a/modules/septima-lang/tests/septima.spec.ts +++ b/modules/septima-lang/tests/septima.spec.ts @@ -1018,7 +1018,7 @@ describe('septima', () => { describe('hash', () => { test('foo', () => { const hashOf = (u: unknown) => crypto.createHash('sha224').update(JSON.stringify(u)).digest('hex') - expect(run(`crypto.hash('A')`)).toEqual(hashOf('A')) + expect(run(`crypto.hash224('A')`)).toEqual(hashOf('A')) }) }) test.todo('sort') // expect(run(`[4, 10, 9, 256, 5, 300, 2, 70].sort()`)).toEqual('--')