Added some nice transform hooks

git-svn-id: file:///home/svn/incoming/trunk@2614 4d416f70-5f16-0410-b530-b9f4589650da
unstable
Spoon M 2005-06-09 18:22:39 +00:00
parent b458d7155d
commit 46e78ef153
1 changed files with 15 additions and 0 deletions

View File

@ -16,12 +16,27 @@ class Xor
self.class::EncoderKlass
end
def _unencoded_transform(data)
data
end
def _encoded_transform(data)
data
end
def encode(data, badchars = '', opts = { })
self.raw = data
self.badchars = badchars
self.opts = opts
# apply any transforms to the plaintext data
data = _unencoded_transform(data)
self.encoded, self.key, self.fkey = encoder().find_key_and_encode(data, badchars)
# apply any transforms to the encoded data
self.encoded = _encoded_transform(encoded)
return _prepend() + encoded + _append()
end