Skip to content

Commit

Permalink
Fix spelling and a minor restructure
Browse files Browse the repository at this point in the history
  • Loading branch information
jtdowney committed Sep 23, 2012
1 parent 741116d commit f92c190
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions README.md
Expand Up @@ -10,14 +10,6 @@ hkdf.next_bytes(32)
=> "\f#\xF4b\x98\x9B\x7Fw>|/|k\xF4k\xB7\xB9\x11e\xC5\x92\xD1\fH\xFDG\x94vt\xB4\x14\xCE"
```

You can also give an IO object as the source. It will be read in as a stream to generate the key. The optional arguement ```:read_size``` can be used to control how many bytes are read from the IO at a time.

```ruby
hkdf = HKDF.new(File.new('/tmp/filename'), :read_size => 512)
hkdf.next_bytes(32)
=> "\f#\xF4b\x98\x9B\x7Fw>|/|k\xF4k\xB7\xB9\x11e\xC5\x92\xD1\fH\xFDG\x94vt\xB4\x14\xCE"
```

The default algorithm is HMAC-SHA256, you can override this and other defaults by providing an options hash during construction.

```ruby
Expand All @@ -26,6 +18,14 @@ hkdf.next_bytes(16)
=> "\xC0<\x13\x85\x8C\x84z\xCE\xC7\xCE+\xFF\x1C\xEB\xE6\xBC"
```

You can also give an IO object as the source. It will be read in as a stream to generate the key. The optional argument ```:read_size``` can be used to control how many bytes are read from the IO at a time.

```ruby
hkdf = HKDF.new(File.new('/tmp/filename'), :read_size => 512)
hkdf.next_bytes(32)
=> "\f#\xF4b\x98\x9B\x7Fw>|/|k\xF4k\xB7\xB9\x11e\xC5\x92\xD1\fH\xFDG\x94vt\xB4\x14\xCE"
```

## License

The HKDF gem is released under the [MIT license](http://www.opensource.org/licenses/MIT).

0 comments on commit f92c190

Please sign in to comment.