Code Monkey home page Code Monkey logo

des-ecb-cbc's Introduction

DES-ECB-CBC

Goal

The goal of this project is to write a simple encryption algorithm library to implement DES,ECB and CBC. The programming language is Java.

Initial API

int[] DES(int[] plaintext, int[] key)
int[] ECB(String plaintext, String key)
int[] CBC(String plaintext, String key, String IV)

Test data

(1) DES
Input:
int[] plaintext = { 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1};

int[] key = { 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1 };

Output:
int[] = ciphertext = { 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1}

(2) ECB
Input:
String plaintext = “I LOVE SECURITY”;
String key = “ABCDEFGH”;
Output:
Int[] ciphertext = {198, 252, 213, 112, 106, 165, 23, 145, 29, 52, 125, 61, 85, 217, 102, 155};
Input:
String plaintext = “GO GATORS!”
String key = “ABCDEFGH”
Output:
Int[] ciphertext = {86, 100, 180, 248, 126, 142, 38, 5, 255, 224, 149, 93, 149, 189, 237, 2};

(3) CBC
Input:
String plaintext = “I LOVE SECURITY”;
String key = “ABCDEFGH”;
String IV = “ABCDEFGH”;
Output:
Int[] ciphertext = {63, 69, 76, 252, 154, 205, 193, 162, 46, 88, 102, 161, 151, 14, 56, 97};
Input:
String plaintext = “SECURITYSECURITY”;
String key = “ABCDEFGH”;
String IV = “ABCDEFGH”;
Output:
Int[] ciphertext = {232, 111, 39, 242, 85, 25, 41, 106, 39, 52, 175, 62, 196, 141, 176, 70};

des-ecb-cbc's People

Contributors

huiliang-m avatar

Stargazers

 avatar  avatar  avatar

Watchers

 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.