Giter VIP home page Giter VIP logo

sha1's Introduction

SHA1 Digest and HMAC for LispWorks

A very simple implementation of SHA1 and HMAC-SHA1 for LispWorks. The code is intended to be easy to follow and is therefore a little slower than it could be.

Quickstart

There are 6 functions exposed in the sha1 package:

(sha1-digest message)            ;=> digest
(sha1-hex message)               ;=> string
(sha1-base64 message)            ;=> string

(hmac-sha1-digest key message)   ;=> digest
(hmac-sha1-hex key message)      ;=> string
(hmac-sha1-base64 key message)   ;=> string

A digest is a list of 20 bytes. The -hex functions will return a hexadecimal string that is equal to the digest. The -base64 functions will return a base64-encoded string of the digest.

They key and message arguments can either be a sequence of bytes or a string (ASCII or UTF-8).

Some examples (from the Wikipedia pages):

CL-USER > (sha1-digest "")
(218 57 163 238 94 107 75 13 50 85 191 239 149 96 24 144 175 216 7 9)

CL-USER > (sha1-hex "The quick brown fox jumps over the lazy dog")
"2FD4E1C67A2D28FCED849EE1BB76E7391B93EB12"

CL-USER > (sha1-base64 "The quick brown fox jumps over the lazy dog")
"L9ThxnotKPzthJ7hu3bnORuT6xI="

CL-USER > (hmac-sha1-hex "key" "The quick brown fox jumps over the lazy dog")
"DE7C9B85B8B78AA6BC8A7A36F70A90701C9DB4D9"

That's it!

sha1's People

Contributors

massung avatar

Watchers

James Cloos 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.