How to use the js-sha3.keccak_256.create function in js-sha3

To help you get started, we’ve selected a few js-sha3 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nemtech / nem2-sdk-typescript-javascript / test / model / transaction / SecretLockTransaction.spec.ts View on Github external
it('should be created with HashType: Op_Keccak_256 secret', () => {
        const proof = 'B778A39A3663719DFC5E48C9D78431B1E45C2AF9DF538782BF199C189DABEAC7';
        const recipientAddress = Address.createFromRawAddress('SDBDG4IT43MPCW2W4CBBCSJJT42AYALQN7A4VVWL');
        const secretLockTransaction = SecretLockTransaction.create(
            Deadline.create(),
            NetworkCurrencyMosaic.createAbsolute(10),
            UInt64.fromUint(100),
            HashType.Op_Keccak_256,
            keccak_256.create().update(convert.hexToUint8(proof)).hex(),
            recipientAddress,
            NetworkType.MIJIN_TEST,
        );
        deepEqual(secretLockTransaction.mosaic.id.id, NetworkCurrencyMosaic.NAMESPACE_ID.id);
        expect(secretLockTransaction.mosaic.amount.equals(UInt64.fromUint(10))).to.be.equal(true);
        expect(secretLockTransaction.duration.equals(UInt64.fromUint(100))).to.be.equal(true);
        expect(secretLockTransaction.hashType).to.be.equal(1);
        expect(secretLockTransaction.secret).to.be.equal('241c1d54c18c8422def03aa16b4b243a8ba491374295a1a6965545e6ac1af314');
        expect(secretLockTransaction.recipientAddress).to.be.equal(recipientAddress);
    });
github nemtech / nem2-sdk-typescript-javascript / test / model / transaction / SecretProofTransaction.spec.ts View on Github external
it('should be created with HashType: Op_Keccak_256 secret', () => {
        const proof = 'B778A39A3663719DFC5E48C9D78431B1E45C2AF9DF538782BF199C189DABEAC7';
        const secretProofTransaction = SecretProofTransaction.create(
            Deadline.create(),
            HashType.Op_Keccak_256,
            keccak_256.create().update(convert.hexToUint8(proof)).hex(),
            account.address,
            proof,
            NetworkType.MIJIN_TEST,
        );
        expect(secretProofTransaction.hashType).to.be.equal(1);
        expect(secretProofTransaction.secret).to.be.equal('241c1d54c18c8422def03aa16b4b243a8ba491374295a1a6965545e6ac1af314' );
        expect(secretProofTransaction.proof).to.be.equal(proof);
    });
github nemtech / nem2-sdk-typescript-javascript / test / model / transaction / HashTypeLengthValidator.spec.ts View on Github external
it('HashType.Keccak_256 should be exactly 64 chars length', () => {
        expect(HashTypeLengthValidator(HashType.Op_Keccak_256, keccak_256.create().update('abcxyz').hex())).to.be.equal(true);
    });
github nemtech / nem2-sdk-typescript-javascript / e2e / infrastructure / TransactionHttp.spec.ts View on Github external
it('aggregate', () => {
            const secretSeed = Crypto.randomBytes(20);
            const secret = keccak_256.create().update(secretSeed).hex();
            const proof = convert.uint8ToHex(secretSeed);
            const secretLockTransaction = SecretLockTransaction.create(
                Deadline.create(),
                NetworkCurrencyMosaic.createAbsolute(10),
                UInt64.fromUint(100),
                HashType.Op_Keccak_256,
                secret,
                account2.address,
                networkType, helper.maxFee,
            );
            return helper.announce(secretLockTransaction.signWith(account, generationHash)).then(() => {
                const secretProofTransaction = SecretProofTransaction.create(
                    Deadline.create(),
                    HashType.Op_Keccak_256,
                    secret,
                    account2.address,