Skip to content

u8vector setkey blowfish

Chris Petersen edited this page Oct 16, 2014 · 1 revision

u8vector-setkey-blowfish sets key for Blowfish encryption.

Parameter Description
keyidx Key index (0-15)
vect u8vector with encryption key (u8vector-length 8 preferred, or a multiple thereof < 64)

Example

Example 1: Setup blowfish encryption key, encrypt a string and decrypt it again. Requires libcrypto to be in the consoles' LIBRARIES file and rupi to be in the console's MODULES file.

> (u8vector-setkey-blowfish 0 (string->u8vector "BlowFish"))
> (define mystring "The brown fox jumps over the lazy dog!")
> (define encrypted (u8vector-encrypt-blowfish 0 (string->u8vector mystring)))
> (display encrypted)
> (define decrypted (u8vector->string (u8vector-decrypt-blowfish 0 encrypted)))
> (string=? mystring decrypted)
Clone this wiki locally