Skip to content
This repository has been archived by the owner on Jun 17, 2021. It is now read-only.

Releases: ethereumjs/ethereumjs-util

v7.0.2 - Patch Release | Re-Upgrade BN.js to v5

26 May 07:46
58c2476
Compare
Choose a tag to compare

This patch release re-establishes the state of v7.0.0 release and upgrades the BN.js re-export version back to v5 since quick patches for both the v5 (v5.1.2) and the v4 branch (v4.11.9) have been released to fix interoperability issues between the BN.js versions.

This now makes it possible to move to the latest BN.js v5 version and profit from future upgrades and patches.

An upgrade is highly recommended, the v7.0.1 release will be marked as deprecated along this release.

See: Issue #250

v7.0.1 - Patch Release | Downgrade BN.js to v4

15 May 15:28
806b2b2
Compare
Choose a tag to compare

This patch release downgrades the re-exported BN.js version from v5 to v4 (so a continuation of what has being used within the v6.x versions). This is due to some unexpected interoperability problems in libraries using the older v4 BN.js branch in their some of their respective dependencies.

An upgrade is highly recommended, the v7.0.0 release will be marked as deprecated along this release.

See: Issue #250

v7.0.0 - Typestrict API / Crypto Update / Dev Improvements

30 Apr 20:59
03bb3ff
Compare
Choose a tag to compare

[DEPRECATED] This release has been deprecated due to interoperability issues along the BN.js v5 re-export update, please update to v7.0.1.


This release comes with significant changes to the API, updated versions of the core crypto libraries and substantial developer improvements in the form of a refactored test suite and API documentation.

API Changes

Changes to the API have been discussed in Issue #172 and are guided by the principles of:

  • Make the API more typestrict
  • Be less ambiguous regarding accepted values
  • Avoid implicit type conversions
  • Be more explicit on wrong input (just: throw)

While the implemented changes come with some additional need for manual type conversions depending on the usage context, they should finally lead to cleaner usage patterns on the cosuming side and a more predictable, robust and less error-prone control flow.

Some note: for methods where Buffer usage is now enforced you can use the Bytes.toBuffer() method for conversion.

Account Module

Enforced Hex Prefixing for Address Strings

PR: #241

Hex prefixing is now enforced for all address string inputs and functions will throw if a non-hex string is provided:

  • Account.isValidAddress()
  • Account.isZeroAddress()
  • Account.toChecksumAddress()
  • Account.isValidChecksumAddress()

The Account.isPrecompile() method was removed from the code base, PR #242

Enforce Buffer Inputs for Account Methods

PR: #245

Implicit Buffer conversions for the following methods have been removed and Buffer inputs are now enforced:

  • Account.generateAddress()
  • Account.generateAddress2()
  • Account.pubToAddress()
  • AccountprivateToPublic()
  • AccountimportPublic()

Bytes Module

Typestrict Methods and Type-Explicit Method Split-Up

PR: #244

  • Enforced Buffer input for Bytes.setLengthLeft(), Bytes.setLengthRight()
  • Bytes.setLength() has been removed (alias for Bytes.setLengthLeft())
  • Bytes.stripZeros() has been removed (alias for Bytes.unPad())
  • Bytes.unpad has been split up into:
    • Bytes.unpadBuffer()
    • Bytes.unpadHexString()
    • Bytes.unpadArray()

Hash Module

Typestrict Methods and Type-Explicit Method Split-Up

PR #247

The following methods are now Buffer-only:

  • Hash.keccak()
  • Hash.keccak256()
  • Hash.sha256()
  • Hash.ripemd160()

Hash.keccak() gets the following additional convenience methods:

  • Hash.keccakFromString()
  • Hash.keccakFromHexString() (hex string enforced)
    Hash.keccakFromArray()

Hash.sha256() gets the following additional convenience methods:

  • Hash.sha256FromString()
  • Hash.sha256FromArray()

Hash.ripemd160() gets the following additional convenience methods:

  • Hash.ripemd160FromString()
  • Hash.ripemd160FromArray()

Other Breaking Changes

  • Added support for Node 14, PR #249
  • Dropped support for Node 8 along PR #228
  • Updated BN.js library re-export from 4.x to 5.x, PR [#249], #249
  • Removed secp2561 re-export (use methods provided or import directly), PR #228

Cryto Library Updates: Keccak, secp2561

Keccak dependency has been updated from 2.1.0 to 3.0.0. This version comes with prebuilds for Linux, MacOS and Windows so most users won't need to have node-gyp run on installation.

The version update also brings in feature compatibility with newer Node.js versions.

The secp2561 ECDSA dependency has been updated from 3.0.1 to 4.0.1.

Developer Improvements

  • Refactored test suite (module split-up, headless Firefox and Chrome), PR #231
  • Moved CI from Travis to GitHub Actions, PR #231
  • Improved and updated TypeDoc API documentation, PR #232 and PR #236
  • Basic API tests for re-exports (BN.js, RLP, ethjsUtil), PR #235

v6.2.0 - Modular Structure / Updated Keccak

07 Nov 10:42
9354465
Compare
Choose a tag to compare

This release comes with a new file structure, related functionality is now broken down into separate files (like account.js) allowing for more oversight and modular integration. All functionality is additionally exposed through an aggregating index.js file, so this version remains backwards-compatible.

Overview on the new structure:

  • account: Private/public key and address-related functionality (creation, validation, conversion)
  • byte: Byte-related helper and conversion functions
  • constants: Exposed constants (e.g. KECCAK256_NULL_S for the string representation of the Keccak-256 hash of null)
  • hash: Hash functions
  • object: Helper function for creating a binary object (DEPRECATED)
  • signature: Signing, signature validation, conversion, recovery

See associated PRs #182 and #179.

Features

  • account: Added EIP-1191 address checksum algorithm support for toChecksumAddress(),
    PR #204

Bug Fixes

  • bytes: toBuffer() conversion function now throws if strings aren't 0x-prefixed hex values making the behavior of toBuffer() more predictable respectively less error-prone (you might generally want to check cases in your code where you eventually allowed non-0x-prefixed input before), PR #197

Dependencies / Environment

  • Dropped Node 6, added Node 11 and 12 to officially supported Node versions,
    PR #207
  • Dropped safe-buffer dependency,
    PR #182
  • Updated rlp dependency from v2.0.0 to v2.2.3 (TypeScript improvements
    for RLP hash functionality),
    PR #187
  • Made @types/bn.js a dependency instead of a devDependency,
    PR #205
  • Updated keccak256 dependency from v1.4.0 to v2.0.0, PR #168

v6.1.0 - TypeScript

12 Feb 13:29
46ed31d
Compare
Choose a tag to compare

First TypeScript based release of the library, now also including a
type declaration file distributed along with the package published,
see PR #170.

Bug Fixes

  • Fixed a bug in isValidSignature() not correctly returning false
    if passed an s-value greater than secp256k1n/2 on homestead or later.
    If you use the method signature with more than three arguments (so not just
    passing in v, r, s and use it like isValidSignature(v, r, s) and omit
    the optional args) please read the thread from
    PR #171 carefully
    and check your code.

Development

  • Updated @types/node to Node 11 types,
    PR #175
  • Changed browser from Chrome to ChromeHeadless,
    PR #156

v6.0.0 - Major Release

10 Oct 10:00
5347bdb
Compare
Choose a tag to compare
  • Support for EIP-155 replay protection by adding an optional chainId parameter
    to ecsign(), ecrecover(), toRpcSig() and isValidSignature(), if present the
    new signature format relying on the chainId is used, see PR #143
  • New generateAddress2() for CREATE2 opcode (EIP-1014) address creation
    (Constantinople HF), see PR #146
  • [BREAKING] Fixed signature to comply with Geth and Parity in toRpcSig() changing
    v from 0/1 to 27/28, this changes the resulting signature buffer, see PR #139
  • [BREAKING] Remove deprecated sha3-named constants and methods (see v5.2.0 release),
    see PR #154

v5.2.0 - Minor Release

27 Apr 10:37
7e3be1d
Compare
Choose a tag to compare
  • Rename all sha3 hash related constants and functions to keccak, see
    this EIP discussion for context
    (tl;dr: Ethereum uses a slightly different hash algorithm then in the official
    SHA-3 standard)
  • Renamed constants:
    • SHA3_NULL_S -> KECCAK256_NULL_S
    • SHA3_NULL -> KECCAK256_NULL
    • SHA3_RLP_ARRAY_S -> KECCAK256_RLP_ARRAY_S
    • SHA3_RLP_ARRAY -> KECCAK256_RLP_ARRAY
    • SHA3_RLP_S -> KECCAK256_RLP_S
    • SHA3_RLP -> KECCAK256_RLP
  • Renamed functions:
    • sha3() -> keccak() (number of bits determined in arguments)
  • New keccak256() alias function for keccak(a, 256)
  • The usage of the sha-named versions is now DEPRECATED and the related
    constants and functions will be removed on the next major release v6.0.0

v5.1.5 - Bugfix Release

26 Feb 11:32
523432f
Compare
Choose a tag to compare
  • Fix browserify issue leading to 3rd-party build problems, PR #119

v5.1.4 - Build Release

07 Feb 13:42
cf511cc
Compare
Choose a tag to compare
  • Moved to ES5 Node distribution version for easier toolchain integration, PR #114
  • Updated isPrecompile() with Byzantium precompile address range, PR #115

v5.1.3 - Maintenance Release

05 Jan 08:01
Compare
Choose a tag to compare
  • ES6 syntax updates
  • Dropped Node 5 support
  • Moved babel to dev dependencies, switched to env preset
  • Usage of safe-buffer instead of Node Buffer
  • Do not allow capital 0X as valid address in isValidAddress()
  • New methods zeroAddress() and isZeroAddress()
  • Updated dependencies