aboutsummaryrefslogtreecommitdiff
path: root/src/serialization/utils.ts
blob: c94f1990649b81553192b5a7a7158437ff4d1ff0 (plain)
1
2
3
4
5
6
7
8
9
import * as Base from 'lib/base'

export function encodeNumber(n: bigint, length: number): string {
  return Base.encode(n, Base.b2).padStart(length, '0')
}

export function mod(a: number, b: number): number {
  return ((a % b) + b) % b
}