File: scalarmult4.cpp

package info (click to toggle)
nacl 20110221-15
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,560 kB
  • sloc: asm: 19,669; ansic: 13,434; cpp: 1,125; sh: 933; makefile: 32
file content (31 lines) | stat: -rw-r--r-- 755 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <iostream>
#include <iomanip>
#include <string>
using std::string;
using std::cout;
using std::setfill;
using std::setw;
using std::hex;
#include "crypto_scalarmult_curve25519.h"

char bobsk_bytes[32] = {
 0x5d,0xab,0x08,0x7e,0x62,0x4a,0x8a,0x4b
,0x79,0xe1,0x7f,0x8b,0x83,0x80,0x0e,0xe6
,0x6f,0x3b,0xb1,0x29,0x26,0x18,0xb6,0xfd
,0x1c,0x2f,0x8b,0x27,0xff,0x88,0xe0,0xeb
} ;

main()
{
  int i;
  cout << setfill('0');
  string bobsk(bobsk_bytes,sizeof bobsk_bytes);
  string bobpk = crypto_scalarmult_curve25519_base(bobsk);
  for (i = 0;i < bobpk.size();++i) {
    unsigned char c = bobpk[i];
    if (i > 0) cout << ","; else cout << " ";
    cout << "0x" << hex << setw(2) << (unsigned int) c;
    if (i % 8 == 7) cout << "\n";
  }
  return 0;
}