Skip to content

Commit

Permalink
docs(smt): update README.md (#304)
Browse files Browse the repository at this point in the history
  • Loading branch information
cedoor authored Jul 25, 2024
1 parent 687bddc commit e0bbf2f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/smt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ or [JSDelivr](https://www.jsdelivr.com/):
```typescript
import { ChildNodes, SMT } from "@zk-kit/smt"
import sha256 from "crypto-js/sha256"
import { poseidon2 } from "poseidon-lite"
import { poseidon2, poseidon3 } from "poseidon-lite"

// Hexadecimal hashes.
const hash = (childNodes: ChildNodes) => sha256(childNodes.join("")).toString()
Expand All @@ -99,7 +99,7 @@ const tree = new SMT(hash)
console.log(tree.root)

// Big number hashes.
const hash2 = (childNodes: ChildNodes) => poseidon2(childNodes)
const hash2 = (childNodes) => (childNodes.length === 2 ? poseidon2(childNodes) : poseidon3(childNodes))

// Create the SMT with a BigNumber (Poseidon) hash.
const tree2 = new SMT(hash2, true)
Expand Down

0 comments on commit e0bbf2f

Please sign in to comment.