diff options
author | irungentoo <irungentoo@gmail.com> | 2013-07-02 09:53:34 -0400 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2013-07-02 09:53:34 -0400 |
commit | e2967396ac73cb7410787886cdaf072a184ffc49 (patch) | |
tree | 527a74d25a4a0705fc641994fd35bfab22662034 /nacl/tests/scalarmult4.cpp | |
parent | 8928c817df345f29aa0b194743595aa11bd6a8ba (diff) |
Added NaCl crypto library.
Diffstat (limited to 'nacl/tests/scalarmult4.cpp')
-rw-r--r-- | nacl/tests/scalarmult4.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/nacl/tests/scalarmult4.cpp b/nacl/tests/scalarmult4.cpp new file mode 100644 index 00000000..8e4d64e9 --- /dev/null +++ b/nacl/tests/scalarmult4.cpp | |||
@@ -0,0 +1,31 @@ | |||
1 | #include <iostream> | ||
2 | #include <iomanip> | ||
3 | #include <string> | ||
4 | using std::string; | ||
5 | using std::cout; | ||
6 | using std::setfill; | ||
7 | using std::setw; | ||
8 | using std::hex; | ||
9 | #include "crypto_scalarmult_curve25519.h" | ||
10 | |||
11 | char bobsk_bytes[32] = { | ||
12 | 0x5d,0xab,0x08,0x7e,0x62,0x4a,0x8a,0x4b | ||
13 | ,0x79,0xe1,0x7f,0x8b,0x83,0x80,0x0e,0xe6 | ||
14 | ,0x6f,0x3b,0xb1,0x29,0x26,0x18,0xb6,0xfd | ||
15 | ,0x1c,0x2f,0x8b,0x27,0xff,0x88,0xe0,0xeb | ||
16 | } ; | ||
17 | |||
18 | main() | ||
19 | { | ||
20 | int i; | ||
21 | cout << setfill('0'); | ||
22 | string bobsk(bobsk_bytes,sizeof bobsk_bytes); | ||
23 | string bobpk = crypto_scalarmult_curve25519_base(bobsk); | ||
24 | for (i = 0;i < bobpk.size();++i) { | ||
25 | unsigned char c = bobpk[i]; | ||
26 | if (i > 0) cout << ","; else cout << " "; | ||
27 | cout << "0x" << hex << setw(2) << (unsigned int) c; | ||
28 | if (i % 8 == 7) cout << "\n"; | ||
29 | } | ||
30 | return 0; | ||
31 | } | ||