Added some nice transform hooks
git-svn-id: file:///home/svn/incoming/trunk@2614 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
b458d7155d
commit
46e78ef153
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue