jdc

package module
v0.0.0-...-fa12745 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 13, 2020 License: MIT Imports: 4 Imported by: 0

README

JDC - A Custom Digest Cipher in Go

A 256-bit cryptographic cipher using a one-way cryptographic hash function, similar to MDC. It is a CFB-mode (cipher feedback) cipher utilizing SHA-256 as both a key-generation function and as a cipher function.

SHA-256 was chosen as it is compliant with both FIPS-180 and NIST SP 800-108 (US Federal Government standards).

Cipher Diagram

For the first block of plaintext, a 256-bit random initialization vector is used instead of a ciphertext block.

Standard Disclaimer

I am neither a cryptographer or a mathematician. This project is purely for educational and experimental use. Please never use this is a system that requires any real security.

This software is licensed under the MIT License, see LICENSE.txt

API/Usage

go test -v to run the included unit tests.

Encrypt(data []byte, password string) []byte - Encrypts a given byte array with a key derived from a plaintext password. Appends the initialization vector to the beginning of the encrypted data

Decrypt(data []byte, password string) []byte - Decrypts data that has been encrypted with Encrypt. Strips off the initialization vector and block padding and returns the original data only.

References/Acknowledgements

I took this idea from Chapter 14.11 in Bruce Schneier's "Applied Cryptography". The algorithm takes inspiration from the MDC cipher and various techniques defined therein.

  1. https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf
  2. https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-56Cr1.pdf
  3. Bruce Schneier, "Applied Cryptography" (print)

TODO

  • Key generation
  • IV generation
  • Padding
    • Use an approved padding scheme such as PKCS #7
  • Cipher + feedback
  • (Bonus) Robust Decryption validation using a CRC or cryptographic hash
  • (Bonus) Benchmark/Speed tests
  • (Bonus) Refactor/Optimize so that operations are in-place whenever possible

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decrypt

func Decrypt(data []byte, password string) []byte

Decrypt a buffer of MDC-encrypted data

func Encrypt

func Encrypt(data []byte, password string) []byte

Encrypt a buffer of data with MDC

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL