nitlanguage
/
nit.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
af6e899
)
Optimized SequenceRead instantiation with fixed length in Text.xor
author
Philippe Pepos Petitclerc
<ppeposp@gmail.com>
Thu, 5 Nov 2015 20:20:17 +0000
(15:20 -0500)
committer
Philippe Pepos Petitclerc
<ppeposp@gmail.com>
Thu, 5 Nov 2015 20:20:17 +0000
(15:20 -0500)
Signed-off-by: Philippe Pepos Petitclerc <ppeposp@gmail.com>
lib/crypto.nit
patch
|
blob
|
history
diff --git
a/lib/crypto.nit
b/lib/crypto.nit
index
a21a853
..
357eb99
100644
(file)
--- a/
lib/crypto.nit
+++ b/
lib/crypto.nit
@@
-162,7
+162,8
@@
redef class Text
#
# assert "goodmorning".xor(" ".to_bytes) == "GOODMORNING"
fun xor(key: SequenceRead[Byte]): Text do
- var xored = new Bytes.empty
+ var xored = new Bytes.with_capacity(bytelen.max(key.length))
+
var shortest: SequenceRead[Byte]
var longest: SequenceRead[Byte]