des

3DES native library for Nim

Pure Nim score 15/100 · tests present · no docs generated

Summary

Latest Version Unknown
License MIT
CI Status Failing
Downloads 0
Last Indexed 2026-07-21 05:24

Installation

nimble install des
choosenim install des
git clone https://github.com/LucaWolf/des.nim

OS Compatibility

Platform Linux macOS Windows FreeBSD OpenBSD NetBSD Android iOS WASM Embedded
des - - - - - - -

Source

Repository https://github.com/LucaWolf/des.nim
Homepage https://github.com/LucaWolf/des.nim
Registry Source nimble_official

README

des.nim

Build Status

About

This is a Nim port of a C-based DES implementation. It implements single, double and triple DES operations with support for basic data padding. DUKPT simple key management (PEK is cached, not holding the future keys array) with encrypt/decrypt and MAC operations also supported.

Examples

Refer to the test folder for how to DES crypt/decrypt and DUKPT current key(s) derivation.

Notes

  • only the mostly used CBC and ECB modes are implemented. Nowadays, ECB is only useful as an internal helper routine, do not encode your data that way.
  • pay attention to resetting the IV when starting a different logical operation (IV is cached to allow manual chaining)
  • all operations are based on complete input data. For streams, your may want to enhance or build atop the existing implementation. The last processed block may require special handling (see MAC X9.19)

Future

None. All desired operations are now supported. (low priority: perhaps incrementing the internal KSN field and deriving the keys based on it)

Credits

Thanks to the libtomcrypt authors on whose work this library is based.