Package Exports
- ethereumjs-util
- ethereumjs-util/browser/sha3.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ethereumjs-util) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
SYNOPSIS 
A collection of utility functions for ethereum. It can be used in node.js or can be in the browser with browserify.
API
properties
MAX_INTEGER
- The max interger that the VM can handleTWO_POW256
- 2^256SHA3_NULL
- SHA3-256 hash ofnull
SHA3_RLP_ARRAY
- SHA3-256 of an rlp of an empty arraySHA3_RLP
- SHA3-256 hash of the rlp ofnull
ETH_UNITS
- an array of ethereum units
methods
zeros(number)
Returns buffer filled with 0's
number
- the number bytes to to return
pad(val, length)
pads an array
or buffer
with leading zeros till it has length
bytes
val
- the value to padlength
- the of the resulting value
unpad(val)
Trims leading zeros from a buffer or an array
val
- abuffer
to unpad
intToHex(int)
Converts an Integer
into a hex String
int
intToBuffer(int)
Converts an Integer
to a Buffer
int
bufferToInt(buf)
converts a Buffer
to an Interger
buf
fromSigned(buf)
interpets a Buffer
as a signed Integer
and returns a Bignum
buf
toUnsigned(num)
Converts a bignum
to an unsigned interger and returns it as a buffer
num
- abignum
pubToAddress(pubKey)
Returns the ethereum address of a given public key
pubKey
- the public key as abuffer
defineProperties(self, fields)
defines properties on a Object
self
- theObject
to define properties onfields
- an array fields to define
validate(fields, data)
Validate defined fields
fields
data
printBA(ba)
Print a Buffer Array
ba
- anArray
ofBuffers
baToJSON(ba)
converts a buffer array to JSON
ba
- anArray
ofBuffers
TESTING
Node.js Tests use Mocha. Test in the browser use Testling.
LICENSE
GPL