Created
December 23, 2009 04:14
-
-
Save krbullock/262302 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'bindata' | |
module BlockSizeCalculator | |
def ciphertext_block_size(block_size) | |
block_size / CipherBlockSize + | |
(0 == block_size % CipherBlockSize ? 0 : 1) * CipherBlockSize + | |
CipherBlockSize | |
end | |
end | |
class ChrisPalmer < BinData::Record | |
include BlockSizeCalculator | |
uint32 :block_size | |
string :data, :read_length => lambda { ciphertext_block_size(block_size) } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment