GithubHelp home page GithubHelp logo

serpent's Introduction

serpent

Serpent cipher in the AES contest. Used in VE475 challenge 2.

Usage

To compile

make

To generate a random key

./c2 --generate

Output (hexidecimal):

f9200a43b7eeb5e249e008e2164962dc1451ab862506c27ab801eb93113ad76c

To encrypt a message (string)

./c2 --encrypt "ve475" --key "f9200a43b7eeb5e249e008e2164962dc1451ab862506c27ab801eb93113ad76c"

Output (hexidecimal):

b94b1cc0af565b6dbace20279431f1ff

To decrypt a ciphertext(hexidecimal)

./c2 --decrypt "b94b1cc0af565b6dbace20279431f1ff" --key "f9200a43b7eeb5e249e008e2164962dc1451ab862506c27ab801eb93113ad76c"

Output (string):

ve475

Cipher

Serpent cipher is the finalist in the AES contest. For the details of algroithms, see also http://www.cl.cam.ac.uk/~rja14/Papers/serpent.pdf. We implement the cipher following the paper.

Details

  • The key length must be 256-bit. Otherwise it will be refused.
  • if no key specified, random key will be used.
  • Mode ECB for long string

serpent's People

Contributors

jasonqsy avatar syqian avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

serpent's Issues

Make and Import Errors (FIX)

When I downloaded this code and ran the make file I ran into a number of errors you can see hear:

g++ -std=c++11 -O2 -o c2 c2.cpp
c2.cpp: In function 'void key_setup(serpent_key*, void*)':
c2.cpp:170:39: error: 'memcpy' was not declared in this scope
     memcpy (&s_ws.b[0], input, KEY_LEN);
                                       ^
c2.cpp:176:46: error: 'memmove' was not declared in this scope
             memmove (&s_ws.b, &s_ws.b[4], 7*4);
                                              ^
c2.cpp: In function 'size_t hex2bin(void*, const char*)':
c2.cpp:189:22: error: 'strlen' was not declared in this scope
     len = strlen (hex);
                      ^
c2.cpp: In function 'int main(int, char**)':
c2.cpp:298:31: error: 'memset' was not declared in this scope
     memset(key, 0, sizeof(key));
                               ^
c2.cpp:300:29: error: 'strlen' was not declared in this scope
         if (strlen(key_input) % 64 != 0) {
                             ^
c2.cpp:312:43: error: 'strlen' was not declared in this scope
         for (int i = 0; i < strlen(message); i += 16) {
                                           ^
c2.cpp:333:43: error: 'strlen' was not declared in this scope
         for (int i = 0; i < strlen(message); i += 32) {
                                           ^
make: *** [all] Error 1

But after adding #include <cstring> to the imports it fixed all errors

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.