Skip to content

Latest commit

 

History

History
50 lines (29 loc) · 804 Bytes

keccak256.md

File metadata and controls

50 lines (29 loc) · 804 Bytes
title
Keccak256 hashing

Purpose

This package provides Keccak256 hashing functions, as used by Ethereum and Swarm.

Installation

npm install @erebos/keccak256

Usage

import { hash, pubKeyToAddress } from '@erebos/keccak256'

const hashed = hash(Buffer.from('hello'))

const pubKey = Buffer.from('...')
const address = pubKeyToAddress(pubKey)

Interfaces and types

hexValue

Hexadecimal-encoded string prefixed with 0x. This type is exported by the @erebos/hex package.

API

hash()

Arguments

  1. input: Array<number> | Buffer

Returns Array<number>

pubKeyToAddress()

Returns the Ethereum address from the provided key.

Arguments

  1. key: hexValue | Array<number> | Buffer

Returns hexValue