Module utils

This module provides utility functions common to all other submodules of nimcrypto.

Procs

proc ROL[T: uint32 | uint64](x: T; n: int): T {...}{.inline.}
proc ROR[T: uint32 | uint64](x: T; n: int): T {...}{.inline.}
proc hexToBytes(a: string; result: var openArray[byte]) {...}{.raises: [], tags: [].}
same as assert but is always turned on regardless of --assertions
proc fromHex(a: string): seq[byte] {...}{.raises: [], tags: [].}
same as assert but is always turned on regardless of --assertions
proc hexChar(c: byte; lowercase: bool = false): string {...}{.raises: [], tags: [].}
proc toHex(a: openArray[byte]; lowercase: bool = false): string {...}{.raises: [], tags: [].}
iterates over each item of a.
proc stripSpaces(s: string): string {...}{.raises: [], tags: [].}
iterates over each item of a.
proc burnMem(p: pointer; size: Natural) {...}{.raises: [], tags: [].}
"is greater" operator. This is the same as y < x.
proc burnArray[T](a: var openArray[T]) {...}{.inline.}
"is greater" operator. This is the same as y < x.
proc burnMem[T](a: var T) {...}{.inline.}
proc isFullZero(p: pointer; size: Natural): bool {...}{.raises: [], tags: [].}
"is greater" operator. This is the same as y < x.
proc isFullZero[T](a: openArray[T]): bool {...}{.inline.}
"is greater" operator. This is the same as y < x.
proc isFullZero[T](a: T): bool {...}{.inline.}

Templates

template GETU32(p, o): uint32
template GETU64(p, o): uint64
template PUTU32(p, o, v)
template PUTU64(p, o, v)
template BSWAP[T](x: T): T
template LSWAP[T](x: T): T
template EGETU32(p, o): uint32
template EPUTU32(p, o, v)
template EGETU64(p, o): uint64
template EPUTU64(p, o, v)
template GET_DWORD(p: ptr byte; i: int): uint32
template SET_DWORD(p: ptr byte; i: int; v: uint32)
template GET_QWORD(p: ptr byte; i: int): uint64
template SET_QWORD(p: ptr byte; i: int; v: uint64)
template GETU8(p, o): byte
template PUTU8(p, o, v)
template burnMem[T](a: var seq[T])
template burnMem[A; B](a: var array[A, B])