Skip to content

Latest commit

 

History

History
36 lines (25 loc) · 828 Bytes

README.md

File metadata and controls

36 lines (25 loc) · 828 Bytes

Blowfish

Blowfish C++ implementation

image

  • Tested on OSX (32bit/64bit)
  • ECB mode only
  • The key length must be a multiple of 8bit

Usage

#include <iostream>
#include "blowfish.h"

int main(int argc, const char * argv[])
{
    unsigned char key[] = "The quick brown fox jumps over the lazy dog.";
    
    Blowfish blowfish;
    blowfish.SetKey(key, sizeof(key));
    
    // Input/Output length must be a multiple of the block length (64bit)
    unsigned char text[16] = "There's nothing";
    
    blowfish.Encrypt(text, text, sizeof(text));
    std::cout << text << std::endl;
    
    blowfish.Decrypt(text, text, sizeof(text));
    std::cout << text << std::endl;
    
    return 0;
}