ruby-aes : README : 俺約/メモ

README for ruby-aes
===================

Ruby AES <http://rubyforge.org/projects/ruby-aes> is an implementation of the Rijnd
ael algorithm.

Written by Alex Boussinet <mailto:alex.boussinet@gmail.com>

This release is mainly an import from the Ruby Application Archive (RAA).
I’ve added all the versions I was working on (algorithm variations) and a new
C extension for improved performance.
6 variations are available:

* "Normal":
Pure Ruby implementation of the Rijndael algorithm specifications.
Useful for understanding the algorithm.

(ピュアRuby実装。アルゴリズムの勉強に)

* "Optimized":
Pure Ruby implementation based on the "Normal" code but optimized for speed.
The SubBytes and ShiftRows methods have been combined.

(ピュアRuby実装を最適化。SubBytesとShiftRowを結合。

* "Table Optimized 1":
Pure Ruby implementation based on the C code from the Rijndael website.
The arrays of constants are bigger because all the operations are
already computed so it’s mainly based on table look ups.

(RijndaelのCコードに基づいて最適化。テーブルルックアップを使う。)

* "Table Optimized 2":
Pure Ruby implementation based on the "Table Optimized 1" code.
The arrays of constants are bigger because all the operations are
already computed and table look ups are also combined.

(Table Optimized1を最適化)

* "Table Unroll Optimized 1":
Pure Ruby implementation based on the "Table Optimized 1" code.
The change here is that the loops are unrolled.

(Table Optimized1を最適化。ループをunrollする。)

* "Table Unroll Optimized 2":
Pure Ruby implementation based on the "Table Optimized 2" code.
The change here is that the loops are unrolled.

(Table Optimized2を最適化。ループをunrollする。)

* "EXT Table Unroll Optimized 2":
C extension based on the "Table Unroll Optimized 2" code.
This extension is provided for major speed improvement.

(Table Unroll Optimized 2 を基にしたC拡張。高速化。)

All those variations share the same API:

(すべて同じAPIです。)

  Default key_length: 128(デフォルトキー長は128)
  Default mode: ‘ECB’ (デフォルトのCipherモードはECB)
  Default IV: 16 null chars ("00" * 16 in hex format) (デフォルトの初期化ベクターは0x00の16配列)
  Default key: 16 null chars ("00" * 16 in hex format) (デフォルトのキーは0x00の16配列)
  Default input text: "PLAINTEXT"  (デフォルトのプレーンテキストはPLAINTEXT)

  Aes.check_key(key_string, key_length)
  Aes.check_iv(iv_string)
  Aes.check_kl(key_length)
  Aes.check_mode(mode)
  Aes.init(key_length, mode, key, iv)
  Aes.encrypt_block(key_length, mode, key, iv, block) # no padding
  Aes.decrypt_block(key_length, mode, key, iv, block) # no padding
  Aes.encrypt_buffer(key_length, mode, key, iv, block) # padding
  Aes.decrypt_buffer(key_length, mode, key, iv, block) # padding
  Aes.encrypt_stream(key_length, mode, key, iv, sin, sout)
  Aes.decrypt_stream(key_length, mode, key, iv, sin, sout)
  Aes.bs() # block size for read operations (stream)
  Aes.bs=(bs)

Valid modes are: (Cipher Mode : ECB,CBC,OFB ,CFB)
    * ECB (Electronic Code Book)
    * CBC (Cipher Block Chaining)
    * OFB (Output Feedback)
    * CFB (Cipher Feedback)

Valid key length:(キー長)
    * 128 bits
    * 192 bits
    * 256 bits

For a really good encryption, 256 bits CBC is recommanded. (256ビットキー長のCBCが良い)

For more information on AES-Rijndael, see: <http://csrc.nist.gov/encryption/aes/rijndael/>

カテゴリー: 未分類 パーマリンク

コメントを残す

以下に詳細を記入するか、アイコンをクリックしてログインしてください。

WordPress.com ロゴ

WordPress.com アカウントを使ってコメントしています。 ログアウト / 変更 )

Twitter 画像

Twitter アカウントを使ってコメントしています。 ログアウト / 変更 )

Facebook の写真

Facebook アカウントを使ってコメントしています。 ログアウト / 変更 )

Google+ フォト

Google+ アカウントを使ってコメントしています。 ログアウト / 変更 )

%s と連携中