scalarmult4.cpp 755 B

12345678910111213141516171819202122232425262728293031
  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. char bobsk_bytes[32] = {
  11. 0x5d,0xab,0x08,0x7e,0x62,0x4a,0x8a,0x4b
  12. ,0x79,0xe1,0x7f,0x8b,0x83,0x80,0x0e,0xe6
  13. ,0x6f,0x3b,0xb1,0x29,0x26,0x18,0xb6,0xfd
  14. ,0x1c,0x2f,0x8b,0x27,0xff,0x88,0xe0,0xeb
  15. } ;
  16. main()
  17. {
  18. int i;
  19. cout << setfill('0');
  20. string bobsk(bobsk_bytes,sizeof bobsk_bytes);
  21. string bobpk = crypto_scalarmult_curve25519_base(bobsk);
  22. for (i = 0;i < bobpk.size();++i) {
  23. unsigned char c = bobpk[i];
  24. if (i > 0) cout << ","; else cout << " ";
  25. cout << "0x" << hex << setw(2) << (unsigned int) c;
  26. if (i % 8 == 7) cout << "\n";
  27. }
  28. return 0;
  29. }