1. 程式人生 > >ZeroMQ介面函式之 :zmq_z85_encode – 使用Z85演算法對一個二進位制祕鑰進行加密,輸出可列印的文字

ZeroMQ介面函式之 :zmq_z85_encode – 使用Z85演算法對一個二進位制祕鑰進行加密,輸出可列印的文字

zmq_z85_encode(3)          ØMQ Manual - ØMQ/4.1.0

Name

zmq_z85_encode – 使用Z85演算法對一個二進位制祕鑰進行加密,輸出可列印的文字

Synopsis

char *zmq_z85_encode (char *dest, uint8_t *data, size_t size);

Description

zmq_z85_encode()函式會對data引數和size引數指定的二進位制資料塊進行加密,並以字串形式儲存在dest引數指定的空間內。這個二進位制資料塊的大小必須是可以被4整除的。dest引數指定的空間大小至少滿足size * 1.25 + 1,最後1個位元組用來儲存字串結束符。一個32B長的密碼會被加密後會變成40B長再加1B的空字元。

加密方式遵循ZMQ RFC 32 規格。

Return value

如果zmq_z85_encode()函式執行成功,則會返回dest的指標,否則返回NULL。

Example

  加密一個curve密碼

1 #include <sodium.h>
2 uint8_t public_key [32];
3 uint8_t secret_key [32];
4 int rc = crypto_box_keypair (public_key, secret_key);
5 assert (rc == 0);
6 char encoded [41];
7 zmq_z85_encode (encoded, public_key, 32
); puts (encoded);

See also

zmq_z85_decode(3)  zmq_curve_keypair(3)  zmq_curve(7)

Authors

This page was written by the ØMQ community. To make a change please read the ØMQ Contribution Policy at http://www.zeromq.org/docs:contributing.

Web site design and content is copyright (c) 2007-2012 iMatix Corporation. Contact us for professional support. Site content licensed under the Creative Commons Attribution-Share Alike 3.0 License. ØMQ is copyright (c) Copyright (c) 2007-2012 iMatix Corporation and Contributors. ØMQ is free software licensed under the LGPL. ØMQ, ZeroMQ, and 0MQ are trademarks of iMatix Corporation. Terms of Use — Privacy

Policy

翻譯:風波

mail : [email protected]