git.stg.codes
/
stg.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
34d407f
)
Always think about \0 and block boundry during encryption.
author
Maxim Mamontov
<faust@stg.dp.ua>
Thu, 26 Jun 2014 13:24:21 +0000
(16:24 +0300)
committer
Maxim Mamontov
<faust@stg.dp.ua>
Thu, 26 Jun 2014 13:24:21 +0000
(16:24 +0300)
tests/test_crypto.cpp
patch
|
blob
|
history
diff --git
a/tests/test_crypto.cpp
b/tests/test_crypto.cpp
index 47dbcbb4361daa0b1341882da7e39f7290433573..f95ecdb0d006f6f8cd61eeea880fb590ab5d79e9 100644
(file)
--- a/
tests/test_crypto.cpp
+++ b/
tests/test_crypto.cpp
@@
-423,11
+423,12
@@
namespace tut
BLOWFISH_CTX ctx;
InitContext("pr7Hhen", 7, &ctx);
BLOWFISH_CTX ctx;
InitContext("pr7Hhen", 7, &ctx);
- char longTest[] = "abcdefghijklmnopqrstuvwxyz 0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ";
- EncryptString(longTest, longTest, sizeof(longTest), &ctx);
+ std::string source("abcdefghijklmnopqrstuvwxyz 0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ");
+ char longTest[source.length() + 8];
+ EncryptString(longTest, source.c_str(), source.length() + 1, &ctx);
DecryptString(longTest, longTest, sizeof(longTest), &ctx);
DecryptString(longTest, longTest, sizeof(longTest), &ctx);
- ensure
("DecryptString(EncryptString(longTest)) == longTest", equalString(longTest, "abcdefghijklmnopqrstuvwxyz 0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ", sizeof(longTest)
));
+ ensure
_equals("DecryptString(EncryptString(longTest)) == longTest", source, std::string(longTest
));
}
}
}
}