Git Product home page Git Product logo

sha-1's Introduction

SHA-1 Algorithm in Object-Oriented Ruby

Overview

This code implements the SHA-1 hashing algorithm as described in the Federal Information Processing Standards Publication: Secure Hash Standard using an object-oriented approach in pure ruby.

Command Line Interface

This program can be run from the command line in the base directory of the project by using the following command format:

$ ruby lib/sha1_hexdigest.rb message

where message can either either be in quotes or not in quotes.

Examples

$ ruby lib/sha1_hexdigest.rb toni
Your SHA-1 Hex Digest for the message 'toni' is:
532ff71c0f0c138e61afd0c77279be9f5bb6c4f0

$ ruby lib/sha1_hexdigest.rb 'longer multi word message in quotes'
Your SHA-1 Hex Digest for the message 'longer multi word message in quotes' is:
b1676709057f22073ee08832f2d91f05a90e7a0b

Testing Suite

Each class has a corresponding testing file written with minitest which can be run from the terminal using mrspec:

$ mrspec

Preprocessor
  encodes long message length as sixty four bit string
  converts lower case letter to binary
  creates initial hash in binary
  calculates number of blocks for large string
  converts ascii number 24 to binary
  converts different upper case letter to binary
  << further output omitted for brevity >>

Dependencies

Must have the mrspec gem and minitest gem installed.

Alternatively, you could run the tests without using mrspec by running the following command with the name of one of the test files:

$ ruby spec/preprocessor_test.rb
Run options: --seed 21667

# Running:

.......................

Fabulous run in 0.004672s, 4923.4405 runs/s, 5565.6284 assertions/s.

23 runs, 26 assertions, 0 failures, 0 errors, 0 skips

No other gems are required to run this program.

sha-1's People

Contributors

tonirib avatar joshcheek avatar

Watchers

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