1.0.1 • Published 4 years ago

pockenacci v1.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

pockenacci

a quick PoC JS implementation of Justin Troutman's Pockenacci block cipher

const Pockenacci = require('.')

const pockenacci = new Pockenacci()

pockenacci.setKey('SECRET')

const { ciphertext, mac } = pockenacci.encrypt(
  'THIS IS A SECRET MESSAGE THAT WE NEED TO HIDE we really need to hide it'
)
/*
ciphertext:
  1EMOIM MS1KM0 LEIU1K 1HVYQI OSPNZ1 0D4SQM
  5TV355 5L43PM 5DT35M 1E5OIM QY53M5 LX5UZ5

mac:
  084189 676048 088240 286468 648248 666060
  868047 468089 608000 888040 648664 680664
*/

try {
  const { plaintext } = pockenacci.decrypt(ciphertext, mac, 'SECRET')
} catch (e) {
  // throws on invalid mac
}

/*
plaintext:
  THIS IS A SECRET MESSAGE THAT WE NEED TO HIDE we really need to hide it
*/

todo

  • key expansion
  • encryption
  • mac checking
  • decryption

License

MIT

1.0.1

4 years ago

1.0.0

4 years ago