Code Monkey home page Code Monkey logo

crysp's Introduction

Crysp

Crypto Stuff in Python

https://travis-ci.org/bdcht/crysp.svg?branch=master
Status: Under Development
Location: https://github.com/bdcht/crysp
Version: 0.9

Description

crysp is a python package with some of my crypto-related facilities.

Install

crysp/utils suggests the following python packages:

Overview

bits.py

Contains the bitvector/bitstream manipulation methods. This module defines the classes:

  • Bits

Bits.

A Bits object is defined by a long ival, a size field and a mask. It can be created from either:

  • an int or long,
  • a list of bit values ([0,0,1,...,0,1,1]) with LSB first,
  • a string, also with LSB first,
  • or another Bits instance.

A Bits object ival holds the list of bits encoded in base10 with bit0 being the LSB of ival. When created from an integer value, this value simply defines the ival, and the size/mask is computed automatically. When created from a bit list the list defines bits LSB to MSB. When created from a string, the string is parsed as a stream of bits : the bit with index 0 (LSB of ival) is the MSB of the first char. It can be tricky to get used to this initialisation convention, especially looking at /b1/ and /b3/ in the following example: Optionnally, the bytestring can be decoded as a little-endian arbitrary long integer by using parameter bitorder=1:

>>> b1 = Bits(10)
>>> b2 = Bits([0,1,0,1])
>>> b3 = Bits('\x50',size=4)
>>> b4 = Bits('\x0a',size=4,bitorder=1)
>>> b1==b2==b3==b4
True

poly.py

Contains the bytevector/bytestream manipulation methods. This module defines the classes:

  • Poly

Poly.

This class API is very similar to Bits, but extends to polynomials in arbitrary rings. It allows for example to operate on bytes (ring=256) rather than bits.

crc.py

Contains generic CRC and CRC32 manipulation algorithms. This module defines the functions:

  • crc_table, crc_back_table
  • crc
  • crc_back_pos
  • crc32
  • crc32_back_pos
  • crc32_fix, crc32_fix_pos

Most functions are self-explanatory ;)

des.py

wb.py

keccak.py

Contains the Keccak class which provides a full implementation of the Keccak sponge functions family. This module also defines the 4 SHA-3 instances: sha3_224, sha3_256, sha3_384, sha3_512. See tests/test-keccak.py for examples.

utils/

Contains some grandpa crypto utilities that are still useful sometimes...

crysp's People

Contributors

bdcht avatar

Watchers

 avatar  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.