hasch
TypeScript icon, indicating that this package has built-in type declarations

3.2.2 • Public • Published

Welcome to hasch 👋

Version License: ISC

Install

npm i hasch

Usage

import hasch from 'hasch'

  hasch(new Uint8Array(123))             === 328550458801291844070341966987876531409n
  hasch('abc')                           === 30216508460253319331260144576202890925n
  hasch(123)                             === 235074070585844934564733336785530021059n
  hasch(Buffer.alloc(5))                 === 82223369041381735457708905440885830446n

  hasch('abc', { seed: 123 })            === 266221380790302914276811936392392262090n
  hasch('abc', { seed: 246 })            === 268273496397672601563576200830246633940n

  hasch('abc', { base: 8 })              === "265667634335613025344536104026336337257255"
  hasch('abc', { base: 12 })             === "617b98437b43184529042060a7607120125"
  hasch('abc', { base: 36 })             === "1cg66nyuy96rto54mr28cm84t"
  hasch('abc', { base: 36, seed: 1000 }) === "7v1fb64sz40yaulnbbn5uogpr"

  hasch('abc', { base: 36, length: 6 })  === "1cg66n"
  hasch('abc', { base: 36, length: 20 }) === "1cg66nyuy96rto54mr28"
  hasch('abc', { base: 36, length: 30 }) === "000001cg66nyuy96rto54mr28cm84t"

  hasch('abc', { decimal: true })        === 0.0144576202890925
  hasch('abc', { choose: [2, 4, 'a'] })  === 2

Author

👤 Konrad Pettersson

🤝 Contributing

Contributions, issues and feature requests are welcome!
Feel free to create an issue on GitHub.

This README was generated with ❤️ by readme-md-generator

Readme

Keywords

Package Sidebar

Install

npm i hasch

Weekly Downloads

72

Version

3.2.2

License

ISC

Unpacked Size

4.38 kB

Total Files

4

Last publish

Collaborators

  • konkenbonken