scalarmult3.cpp 771 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 alicesk_bytes[32] = {
  11. 0x77,0x07,0x6d,0x0a,0x73,0x18,0xa5,0x7d
  12. ,0x3c,0x16,0xc1,0x72,0x51,0xb2,0x66,0x45
  13. ,0xdf,0x4c,0x2f,0x87,0xeb,0xc0,0x99,0x2a
  14. ,0xb1,0x77,0xfb,0xa5,0x1d,0xb9,0x2c,0x2a
  15. } ;
  16. main()
  17. {
  18. int i;
  19. cout << setfill('0');
  20. string alicesk(alicesk_bytes,sizeof alicesk_bytes);
  21. string alicepk = crypto_scalarmult_curve25519_base(alicesk);
  22. for (i = 0;i < alicepk.size();++i) {
  23. unsigned char c = alicepk[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. }