zmq_z85_encode.txt 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. zmq_z85_encode(3)
  2. =================
  3. NAME
  4. ----
  5. zmq_z85_encode - encode a binary key as Z85 printable text
  6. SYNOPSIS
  7. --------
  8. *char *zmq_z85_encode (char *dest, const uint8_t *data, size_t size);*
  9. DESCRIPTION
  10. -----------
  11. The _zmq_z85_encode()_ function shall encode the binary block specified
  12. by 'data' and 'size' into a string in 'dest'. The size of the binary block
  13. must be divisible by 4. The 'dest' must have sufficient space for size * 1.25
  14. plus 1 for a null terminator. A 32-byte CURVE key is encoded as 40 ASCII
  15. characters plus a null terminator.
  16. The encoding shall follow the ZMQ RFC 32 specification.
  17. RETURN VALUE
  18. ------------
  19. The _zmq_z85_encode()_ function shall return 'dest' if successful, else it
  20. shall return NULL.
  21. EXAMPLE
  22. -------
  23. .Encoding a CURVE key
  24. ----
  25. #include <sodium.h>
  26. uint8_t public_key [32];
  27. uint8_t secret_key [32];
  28. int rc = crypto_box_keypair (public_key, secret_key);
  29. assert (rc == 0);
  30. char encoded [41];
  31. zmq_z85_encode (encoded, public_key, 32);
  32. puts (encoded);
  33. ----
  34. SEE ALSO
  35. --------
  36. linkzmq:zmq_z85_decode[3]
  37. linkzmq:zmq_curve_keypair[3]
  38. linkzmq:zmq_curve_public[3]
  39. linkzmq:zmq_curve[7]
  40. AUTHORS
  41. -------
  42. This page was written by the 0MQ community. To make a change please
  43. read the 0MQ Contribution Policy at <http://www.zeromq.org/docs:contributing>.