Giter Site home page Giter Site logo

blowfish's Introduction

BLOWFISH ENCRYPTION ALGORITHM

Fork of https://github.com/prophet6250/blowfish-implementation.

Compile the code

gcc blowfish.c main.c -o ./blowfish -lm

Usage

./blowfish <arg> <plaintext>

<arg> can take the following parameters:

Arg Description
encrypt Performs a regular Blowfish encryption
sbox Attack model when attacking round keys via sboxes
xor Attack model when attacking round keys via XOR operations
feistel Attack model when attacking the result of f()
print_feistel Print the result of f() for a given input

<plaintext> consists of 8 input bytes in decimal form, delimited by a space, such as 1 2 3 4 5 6 7 8.

The encryption key is hardcoded in main.c.

Countermeasures

Countermeasures are implemented in the countermeasures directory, which contains a separate copy of the code. Here, the blowfish binary only takes <plaintext> as an argument and always performs a regular Blowfish encryption.


ORIGINAL README BELOW

ABOUT

My Implementation of the 64-bit Blowfish Cryptographic block cipher

This is(never was) not meant to be used in production code, nor as a source of reference. This was purely a programming excercise. Mistakes & vulnerabilities are bound to creeep into this code. So don't use this code in professional environments.

REQUIREMENTS

My machine has GCC version 9.2.0. Although, any C compiler, with support of ISO C11 may be used to compile this code, preferably GCC version 4.9+

COMPILE AND RUN

gcc blowfish.c main.c -o ./blow -lm

./blow

HOW TO CHANGE PREDEFINED INPUTS

Inside main.c, there are two macro definitions, namely #define PLAINTEXT and #define KEY. Edit these values with your own custom plaintext and key values. Keep in mind, keysize should not be greater than 56 characters (preferable less than 55).

RESOURCES USED

  1. https://morf.lv/introduction-to-data-encryption (basic feistel cipher and then Blowfish using Qt and C++)

blowfish's People

Contributors

sihensel avatar prophet6250 avatar infosec-crow avatar kefranzl avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.