Giter VIP home page Giter VIP logo

cryptogo's Introduction

cryptogo

Simple cryptography API in Go

  1. Hashes:

    • hash.MD5Bytes, hash.MD5Base64, hash.MD5Hex
      calculates an MD5 chechsum of the input byte array as a byte array, base64-encoded string or hex-encoded string

    • hash.SHA1Bytes, hash.SHA1Base64, hash.SHA1Hex
      calculates an SHA1 chechsum of the input byte array as a byte array, base64-encoded string or hex-encoded string

    • hash.SHA224Bytes, hash.SHA224Base64, hash.SHA224Hex
      calculates an SHA-224 chechsum of the input byte array as a byte array, base64-encoded string or hex-encoded string

    • hash.SHA256Bytes, hash.SHA256Base64, hash.SHA256Hex
      calculates an SHA-256 chechsum of the input byte array as a byte array, base64-encoded string or hex-encoded string

    • hash.SHA384Bytes, hash.SHA384Base64, hash.SHA384Hex
      calculates an SHA-384 chechsum of the input byte array as a byte array, base64-encoded string or hex-encoded string

    • hash.SHA512Bytes, hash.SHA512Base64, hash.SHA512Hex
      calculates an SHA-512 chechsum of the input byte array as a byte array, base64-encoded string or hex-encoded string

  2. Password-based (PB):

    • pb.PBAesEncrypt encrypts input byte array using string password specified into a new (encrypted) byte array

    • pb.PBAesDecrypt decrypts input byte array using string password specified into a new (decrypted) byte array

    • pb.PBSignRequest signs an http request using a string password; adds 2 additional headers to the request

    • pb.PBVerifyRequest verifies previously signed http request using a string password

  3. Paddings

    • pad.PKCS7Pad adds PKCS #7 padding to an input byte array, returning new (padded) byte array

    • pad.PKCS7Unpad removes PKCS #7 padding from an input byte array, returning new (striped) byte array;
      checks if padding is correct

    • pad.X923Pad adds ANSI X.923 padding to an input byte array, returning new (padded) byte array

    • pad.X923Unad removes ANSI X.923 padding from an input byte array, returning new (striped) byte array;
      checks if padding is correct

  4. Random

    • rnd.RandomBytes generates a random byte array of the specified length

    • IV synonim for RandomBytes, used to generate random IV

    • Salt synonim for RandomBytes, used to generate random Salt

  5. Asymetric Cryptography

    • asym.GenerateKeyPair generates private/public key pair, result is returned as two strings

    • asym.Sign signes a byte array (usually hash) using private key specified

    • asym.Verify verifies a byte array signature using public key specified

cryptogo's People

Contributors

vgorin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

cryptogo's Issues

PB: Make Enc/Dec Parameters Configurable

const PBKDF2_ITERATIONS = 1 << 15 // 32k (approx.)
const PBKDF2_SALT_LENGTH = 1 << 4 // 128 bit
const AES_BLOCK_LENGTH = 1 << 4 // 128 bit
const AES_KEY_LENGTH = 24 // 24 bytes (192-bit)
const HMAC_KEY_LENGTH = 1 << 5 // 32 bytes (256-bit)

make these configurable (all except AES_BLOCK_LENGTH which is always 128 bit for AES)

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.