Sha256: 5fa975c2226108604437eb7e26b2331f1d58da1ad8139f13b5b2fea684d8bfc3

Contents?: true

Size: 1.71 KB

Versions: 2

Compression:

Stored size: 1.71 KB

Contents

h1. H

h2. Overview

Very small cryptographic tool that generates on-the-fly custom message digests,
according to some parameters.

h2. Why?

Because I prefer to put makeup on passwords rather than yield them to Managerâ„¢.

h2. Installation

<pre>
  gem install h
</pre>

h2. Configuration

H reads its configuration from the YAML <tt>~/.h</tt> file at initialization.
This file, which should be readable by its owner only, has four parameters:

 * Max length: The maximum length of returned message digests.
 * Radix: The number of unique digits that compose message digests.
 * Encryption: A cryptographic hash function in Ruby's Digest module.
 * Static key: Provides salted messages through concatenation.

h2. Examples

Generate a digest from the system:

<pre>
  $ h secret
  t3dpe24xie3y74t
</pre>

Because no configuration has been detected, this default file was created:

<pre>
  $ cat ~/.h
  ---
  max_length: 15
  radix: 36
  encryption: SHA1
  static_key: foobar
</pre>

Same operation, from Ruby:

<pre>
  irb(main):001:0> require "h"
  true
  irb(main):002:0> H::Generator.new.input "secret"
  "t3dpe24xie3y74t"
</pre>

To prevent your log display the message as a string, do not specify it at first.

<pre>
  $ h
  Message: ******
  t3dpe24xie3y74t
</pre>

Example with the SHA2 cryptographic hash instead of SHA1, and a custom key:

<pre>
  $ echo "{max_length: 15, radix: 36, encryption: SHA2, static_key: sun}" > ~/.h
  $ h secret
  5gumh4smv1iit23
</pre>

And now a useless test, with conventional parameters. You can Google the result.

<pre>
  $ echo "{max_length: 40, radix: 16, encryption: SHA1, static_key: ''}" > ~/.h
  $ h "The quick brown fox jumps over the lazy dog"
  2fd4e1c67a2d28fced849ee1bb76e7391b93eb12
</pre>

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
h-1.0.1 README.textile
h-1.0.0 README.textile