This module implements Twofish crypto algorithm by Bruce Schneier.
Code based on Optimized C created by Drew Csillag [https://www.schneier.com/code/twofish-cpy.zip].
Tests made according to official test vectors [https://www.schneier.com/code/ecb_ival.txt].
Types
twofish128 = TwofishContext[128]
twofish192 = TwofishContext[192]
twofish256 = TwofishContext[256]
twofish = twofish128 | twofish192 | twofish256
Procs
proc init(ctx: var TwofishContext; key: ptr byte; nkey: int = 0) {...}{.inline.}
proc init(ctx: var TwofishContext; key: openArray[byte]) {...}{.inline.}
- "is greater or equals" operator. This is the same as y <= x.
proc clear(ctx: var TwofishContext) {...}{.inline.}
proc encrypt(ctx: var TwofishContext; inbytes: ptr byte; outbytes: ptr byte) {...}{.inline.}
proc decrypt(ctx: var TwofishContext; inbytes: ptr byte; outbytes: ptr byte) {...}{.inline.}
proc encrypt(ctx: var TwofishContext; input: openArray[byte]; output: var openArray[byte]) {...}{.inline.}
proc decrypt(ctx: var TwofishContext; input: openArray[byte]; output: var openArray[byte]) {...}{.inline.}