|  |   | 
| (4 intermediate revisions by the same user not shown) | 
| Line 22: | Line 22: | 
|  |  |  |  | 
|  | ==Detailed description== |  | ==Detailed description== | 
|  | + |  | 
|  | + |  | 
|  |  |  |  | 
|  |  |  |  | 
| Line 47: | Line 49: | 
|  |  |  |  | 
|  |  |  |  | 
| − | ''<span style="color:red;">No additional examples</span>''
 |  | 
|  |  |  |  | 
| − | ==Macro reference==
 |  | 
|  |  |  |  | 
| − | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 | + | ''<span style="color:red;">No additional examples</span>'' | 
| − | |-
 |  | 
| − | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 |  | 
| − | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''sign_create'''
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Computes a signature for a message using the secret key. Returns 0 if successful. 
 |  | 
| − | |-
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 |  | 
| − | | width="90%" | signature
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Buffer to receive the signature. Must be 64 bytes. 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 |  | 
| − | | width="90%" | message
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Buffer containing the data to sign 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 |  | 
| − | | width="90%" | message_size
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Byte count of the message 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 |  | 
| − | | width="90%" | secret_key
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Secret/Private key to be used.Size is 64 bytes. 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-s16-icon.png]] - INT
 |  | 
| − | | width="90%" style="border-top: 2px solid #000;" | ''Return''
 |  | 
| − | |}
 |  | 
|  |  |  |  | 
|  |  |  |  | 
| − | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 |  | 
| − | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''secretbox_keygen'''
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Creates a secret key suitable for use with the secretbox functions. You must provide a 32 byte array for the key. 
 |  | 
| − | |-
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 |  | 
| − | | width="90%" | key
 |  | 
| − | |-
 |  | 
| − | | colspan="2" |  
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 |  | 
| − | | width="90%" style="border-top: 2px solid #000;" | ''Return''
 |  | 
| − | |}
 |  | 
|  |  |  |  | 
|  |  |  |  | 
| − | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 |  | 
| − | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''hash_with_key'''
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Creates a hash fingerprint of the data, using the given key. Returns 0 if successful. 
 |  | 
| − | |-
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 |  | 
| − | | width="90%" | hash
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Buffer for the hash. Size >=32 makes it practically impossible for two messages to produce the same fingerprint. 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 |  | 
| − | | width="90%" | data
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | The data buffer to be processed 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 |  | 
| − | | width="90%" | size
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Byte count of the data to be processed 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 |  | 
| − | | width="90%" | key
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Key to be used 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-s16-icon.png]] - INT
 |  | 
| − | | width="90%" style="border-top: 2px solid #000;" | ''Return''
 |  | 
| − | |}
 |  | 
|  |  |  |  | 
|  |  |  |  | 
| − | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 |  | 
| − | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''sign_verify'''
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Verify the signature of a mesasge using the public key. Returns 0 if successful. 
 |  | 
| − | |-
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 |  | 
| − | | width="90%" | signature
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Buffer to receive the signature. Must be 64 bytes. 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 |  | 
| − | | width="90%" | message
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Buffer containing the data to sign 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 |  | 
| − | | width="90%" | message_size
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Byte count of the message 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 |  | 
| − | | width="90%" | public_key
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Public key to be used.Size is 32 bytes. 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-s16-icon.png]] - INT
 |  | 
| − | | width="90%" style="border-top: 2px solid #000;" | ''Return''
 |  | 
| − | |}
 |  | 
|  |  |  |  | 
|  |  |  |  | 
| − | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 |  | 
| − | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''init'''
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Initialisation function. To be called at the very start of your program. 
 |  | 
| − | |-
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-s16-icon.png]] - INT
 |  | 
| − | | width="90%" style="border-top: 2px solid #000;" | ''Return''
 |  | 
| − | |}
 |  | 
|  |  |  |  | 
|  |  |  |  | 
| − | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 |  | 
| − | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''sign_keygen'''
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Creates Private and Public key pair to sign and verify messages. Returns 0 if successful. 
 |  | 
| − | |-
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 |  | 
| − | | width="90%" | Secret
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Buffer to receive the Private/Secret Key. Buffer size must be 64 bytes 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 |  | 
| − | | width="90%" | Public
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Buffer to receive the Public key. Buffer size must be 32 bytes 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-s16-icon.png]] - INT
 |  | 
| − | | width="90%" style="border-top: 2px solid #000;" | ''Return''
 |  | 
| − | |}
 |  | 
| − | 
 |  | 
| − | 
 |  | 
| − | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 |  | 
| − | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''secretbox_encrypt'''
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Encrypts a message with a secret key. A single key is used both to encrypt/sign and verify/decrypt messages. For this reason, it is critical to keep the key confidential. Returns 0 on success. 
 |  | 
| − | |-
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 |  | 
| − | | width="90%" | message
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Buffer containing the message to be encrypted. 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 |  | 
| − | | width="90%" | length
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | The length (byte count) of the message 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 |  | 
| − | | width="90%" | ID
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Message ID. Can be 0 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 |  | 
| − | | width="90%" | key
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | The secret key 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 |  | 
| − | | width="90%" | ciphertext
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Buffer for ciphertext output. Buffer size must be at least length + 36 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-s16-icon.png]] - INT
 |  | 
| − | | width="90%" style="border-top: 2px solid #000;" | ''Return''
 |  | 
| − | |}
 |  | 
|  |  |  |  | 
|  | + | ==Macro reference== | 
|  |  |  |  | 
|  | + | ===hash_keygen=== | 
|  | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" |  | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | 
|  | |- |  | |- | 
| Line 260: | Line 84: | 
|  |  |  |  | 
|  |  |  |  | 
| − | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 | + | ===hash_with_key=== | 
| − | |-
 |  | 
| − | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 |  | 
| − | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''secretbox_decrypt'''
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Decrypts a message with a secret key. A single key is used both to encrypt/sign and verify/decrypt messages. For this reason, it is critical to keep the key confidential. Returns 0 on success. 
 |  | 
| − | |-
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 |  | 
| − | | width="90%" | message
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Buffer for the decrypted message. Size must be at least length - 36 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 |  | 
| − | | width="90%" | length
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | The length (byte count) of the ciphertext 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 |  | 
| − | | width="90%" | ID
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Message ID. Must match with the original message ID. Can be 0 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 |  | 
| − | | width="90%" | key
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | The secret key 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 |  | 
| − | | width="90%" | ciphertext
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Buffer containing the ciphertext to be decrypted. 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-s16-icon.png]] - INT
 |  | 
| − | | width="90%" style="border-top: 2px solid #000;" | ''Return''
 |  | 
| − | |}
 |  | 
| − |   |  | 
| − |   |  | 
| − | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 |  | 
| − | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''hash_without_key'''
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Creates a hash fingerprint of the data, which will always have the same fingerprint, similar to the MD5 or SHA-1 Returns 0 if successful. 
 |  | 
| − | |-
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 |  | 
| − | | width="90%" | hash
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Buffer for the hash. Size >=32 makes it practically impossible for two messages to produce the same fingerprint. 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 |  | 
| − | | width="90%" | data
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Data buffer to be processed 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 |  | 
| − | | width="90%" | size
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Byte count of data to be processed 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-s16-icon.png]] - INT
 |  | 
| − | | width="90%" style="border-top: 2px solid #000;" | ''Return''
 |  | 
| − | |}
 |  | 
| − |   |  | 
| − |   |  | 
| − |   |  | 
| − |   |  | 
| − | ==Property reference==
 |  | 
| − |   |  | 
| − | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
 |  | 
| − | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties''' 
 |  | 
| − | |-
 |  | 
| − | |}==Macro reference==
 |  | 
| − |   |  | 
| − | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 |  | 
| − | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''sign_create'''
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Computes a signature for a message using the secret key. Returns 0 if successful. 
 |  | 
| − | |-
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 |  | 
| − | | width="90%" | signature
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Buffer to receive the signature. Must be 64 bytes. 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 |  | 
| − | | width="90%" | message
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Buffer containing the data to sign 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 |  | 
| − | | width="90%" | message_size
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Byte count of the message 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 |  | 
| − | | width="90%" | secret_key
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Secret/Private key to be used.Size is 64 bytes. 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-s16-icon.png]] - INT
 |  | 
| − | | width="90%" style="border-top: 2px solid #000;" | ''Return''
 |  | 
| − | |}
 |  | 
| − |   |  | 
| − |   |  | 
| − | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 |  | 
| − | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''secretbox_keygen'''
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Creates a secret key suitable for use with the secretbox functions. You must provide a 32 byte array for the key. 
 |  | 
| − | |-
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 |  | 
| − | | width="90%" | key
 |  | 
| − | |-
 |  | 
| − | | colspan="2" |  
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 |  | 
| − | | width="90%" style="border-top: 2px solid #000;" | ''Return''
 |  | 
| − | |}
 |  | 
| − |   |  | 
| − |   |  | 
|  | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" |  | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | 
|  | |- |  | |- | 
| Line 421: | Line 118: | 
|  |  |  |  | 
|  |  |  |  | 
|  | + | ===hash_without_key=== | 
|  | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" |  | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | 
|  | |- |  | |- | 
|  | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] |  | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | 
| − | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''sign_verify''' | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''hash_without_key''' | 
|  | |- |  | |- | 
| − | | colspan="2" | Verify thesignature of a mesasge using thepublic key. Returns 0 if successful.  | + | | colspan="2" | Creates a hash fingerprint of the data, which will always have the same fingerprint, similar to the MD5 or SHA-1 Returns 0 if successful.  | 
|  | |- |  | |- | 
|  | |- |  | |- | 
|  | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE |  | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | 
| − | | width="90%" | signature | + | | width="90%" | hash | 
|  | |- |  | |- | 
| − | | colspan="2" | Buffer to receive thesignature. Must be 64 bytes.  | + | | colspan="2" | Buffer for the hash. Size >=32 makes it practically impossible for two messages to produce the same fingerprint.  | 
|  | |- |  | |- | 
|  | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE |  | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | 
| − | | width="90%" | message | + | | width="90%" | data | 
|  | |- |  | |- | 
| − | | colspan="2" | Buffer containing the data tosign  | + | | colspan="2" | Data buffer to be processed  | 
|  | |- |  | |- | 
|  | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT |  | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT | 
| − | | width="90%" | message_size | + | | width="90%" | size | 
|  | |- |  | |- | 
| − | | colspan="2" | Byte count of the message  | + | | colspan="2" | Byte count of data to be processed  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 |  | 
| − | | width="90%" | public_key
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Public key to beused.Size is 32 bytes. 
 |  | 
|  | |- |  | |- | 
|  | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-s16-icon.png]] - INT |  | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-s16-icon.png]] - INT | 
| Line 454: | Line 147: | 
|  |  |  |  | 
|  |  |  |  | 
|  | + | ===init=== | 
|  | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" |  | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | 
|  | |- |  | |- | 
| Line 467: | Line 161: | 
|  |  |  |  | 
|  |  |  |  | 
| − | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 | + | ===secretbox_decrypt=== | 
| − | |-
 |  | 
| − | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 |  | 
| − | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''sign_keygen'''
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Creates Private and Public key pair to sign and verify messages. Returns 0 if successful. 
 |  | 
| − | |-
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 |  | 
| − | | width="90%" | Secret
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Buffer to receive the Private/Secret Key. Buffer size must be 64 bytes 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 |  | 
| − | | width="90%" | Public
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Buffer to receive the Public key. Buffer size must be 32 bytes 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-s16-icon.png]] - INT
 |  | 
| − | | width="90%" style="border-top: 2px solid #000;" | ''Return''
 |  | 
| − | |}
 |  | 
| − |   |  | 
| − |   |  | 
| − | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 |  | 
| − | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''secretbox_encrypt'''
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Encrypts a message with a secret key. A single key is used both to encrypt/sign and verify/decrypt messages. For this reason, it is critical to keep the key confidential. Returns 0 on success. 
 |  | 
| − | |-
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 |  | 
| − | | width="90%" | message
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Buffer containing the message to be encrypted. 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 |  | 
| − | | width="90%" | length
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | The length (byte count) of the message 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 |  | 
| − | | width="90%" | ID
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Message ID. Can be 0 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 |  | 
| − | | width="90%" | key
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | The secret key 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 |  | 
| − | | width="90%" | ciphertext
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Buffer for ciphertext output. Buffer size must be at least length + 36 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-s16-icon.png]] - INT
 |  | 
| − | | width="90%" style="border-top: 2px solid #000;" | ''Return''
 |  | 
| − | |}
 |  | 
| − |   |  | 
| − |   |  | 
| − | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 |  | 
| − | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''hash_keygen'''
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Creates a secret key suitable for use with the hash_hash function. You must provide a 32 byte array for the key. 
 |  | 
| − | |-
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 |  | 
| − | | width="90%" | key
 |  | 
| − | |-
 |  | 
| − | | colspan="2" |  
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 |  | 
| − | | width="90%" style="border-top: 2px solid #000;" | ''Return''
 |  | 
| − | |}
 |  | 
| − |   |  | 
| − |   |  | 
|  | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" |  | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | 
|  | |- |  | |- | 
| Line 584: | Line 200: | 
|  |  |  |  | 
|  |  |  |  | 
| − | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 | + | ===secretbox_encrypt=== | 
| − | |-
 |  | 
| − | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 |  | 
| − | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''hash_without_key'''
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Creates a hash fingerprint of the data, which will always have the same fingerprint, similar to the MD5 or SHA-1 Returns 0 if successful. 
 |  | 
| − | |-
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 |  | 
| − | | width="90%" | hash
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Buffer for the hash. Size >=32 makes it practically impossible for two messages to produce the same fingerprint. 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 |  | 
| − | | width="90%" | data
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Data buffer to be processed 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 |  | 
| − | | width="90%" | size
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Byte count of data to be processed 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-s16-icon.png]] - INT
 |  | 
| − | | width="90%" style="border-top: 2px solid #000;" | ''Return''
 |  | 
| − | |}
 |  | 
| − |   |  | 
| − |   |  | 
| − |   |  | 
| − |   |  | 
| − | ==Property reference==
 |  | 
| − |   |  | 
| − | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
 |  | 
| − | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties''' 
 |  | 
| − | |-
 |  | 
| − | |}==Macro reference==
 |  | 
| − |   |  | 
| − | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 |  | 
| − | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''sign_create'''
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Computes a signature for a message using the secret key. Returns 0 if successful. 
 |  | 
| − | |-
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 |  | 
| − | | width="90%" | signature
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Buffer to receive the signature. Must be 64 bytes. 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 |  | 
| − | | width="90%" | message
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Buffer containing the data to sign 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 |  | 
| − | | width="90%" | message_size
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Byte count of the message 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 |  | 
| − | | width="90%" | secret_key
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Secret/Private key to be used.Size is 64 bytes. 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-s16-icon.png]] - INT
 |  | 
| − | | width="90%" style="border-top: 2px solid #000;" | ''Return''
 |  | 
| − | |}
 |  | 
| − |   |  | 
| − |   |  | 
| − | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 |  | 
| − | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''secretbox_keygen'''
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Creates a secret key suitable for use with the secretbox functions. You must provide a 32 byte array for the key. 
 |  | 
| − | |-
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 |  | 
| − | | width="90%" | key
 |  | 
| − | |-
 |  | 
| − | | colspan="2" |  
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 |  | 
| − | | width="90%" style="border-top: 2px solid #000;" | ''Return''
 |  | 
| − | |}
 |  | 
| − |   |  | 
| − |   |  | 
| − | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 |  | 
| − | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''hash_with_key'''
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Creates a hash fingerprint of the data, using the given key. Returns 0 if successful. 
 |  | 
| − | |-
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 |  | 
| − | | width="90%" | hash
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Buffer for the hash. Size >=32 makes it practically impossible for two messages to produce the same fingerprint. 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 |  | 
| − | | width="90%" | data
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | The data buffer to be processed 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 |  | 
| − | | width="90%" | size
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Byte count of the data to be processed 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 |  | 
| − | | width="90%" | key
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Key to be used 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-s16-icon.png]] - INT
 |  | 
| − | | width="90%" style="border-top: 2px solid #000;" | ''Return''
 |  | 
| − | |}
 |  | 
| − |   |  | 
| − |   |  | 
| − | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 |  | 
| − | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''sign_verify'''
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Verify the signature of a mesasge using the public key. Returns 0 if successful. 
 |  | 
| − | |-
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 |  | 
| − | | width="90%" | signature
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Buffer to receive the signature. Must be 64 bytes. 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 |  | 
| − | | width="90%" | message
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Buffer containing the data to sign 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 |  | 
| − | | width="90%" | message_size
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Byte count of the message 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 |  | 
| − | | width="90%" | public_key
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Public key to be used.Size is 32 bytes. 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-s16-icon.png]] - INT
 |  | 
| − | | width="90%" style="border-top: 2px solid #000;" | ''Return''
 |  | 
| − | |}
 |  | 
| − |   |  | 
| − |   |  | 
| − | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 |  | 
| − | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''init'''
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Initialisation function. To be called at the very start of your program. 
 |  | 
| − | |-
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-s16-icon.png]] - INT
 |  | 
| − | | width="90%" style="border-top: 2px solid #000;" | ''Return''
 |  | 
| − | |}
 |  | 
| − |   |  | 
| − |   |  | 
| − | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 |  | 
| − | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''sign_keygen'''
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Creates Private and Public key pair to sign and verify messages. Returns 0 if successful. 
 |  | 
| − | |-
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 |  | 
| − | | width="90%" | Secret
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Buffer to receive the Private/Secret Key. Buffer size must be 64 bytes 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 |  | 
| − | | width="90%" | Public
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Buffer to receive the Public key. Buffer size must be 32 bytes 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-s16-icon.png]] - INT
 |  | 
| − | | width="90%" style="border-top: 2px solid #000;" | ''Return''
 |  | 
| − | |}
 |  | 
| − |   |  | 
| − |   |  | 
|  | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" |  | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | 
|  | |- |  | |- | 
| Line 814: | Line 239: | 
|  |  |  |  | 
|  |  |  |  | 
|  | + | ===secretbox_keygen=== | 
|  | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" |  | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | 
|  | |- |  | |- | 
|  | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] |  | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | 
| − | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''hash_keygen''' | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''secretbox_keygen''' | 
|  | |- |  | |- | 
| − | | colspan="2" | Creates a secret key suitable for use with the hash_hash function. You must provide a 32 byte array for the key.  | + | | colspan="2" | Creates a secret key suitable for use with the secretbox functions. You must provide a 32 byte array for the key.  | 
|  | |- |  | |- | 
|  | |- |  | |- | 
| Line 832: | Line 258: | 
|  |  |  |  | 
|  |  |  |  | 
| − | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 | + | ===sign_create=== | 
| − | |-
 |  | 
| − | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 |  | 
| − | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''secretbox_decrypt'''
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Decrypts a message with a secret key. A single key is used both to encrypt/sign and verify/decrypt messages. For this reason, it is critical to keep the key confidential. Returns 0 on success. 
 |  | 
| − | |-
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 |  | 
| − | | width="90%" | message
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Buffer for the decrypted message. Size must be at least length - 36 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 |  | 
| − | | width="90%" | length
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | The length (byte count) of the ciphertext 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 |  | 
| − | | width="90%" | ID
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Message ID. Must match with the original message ID. Can be 0 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 |  | 
| − | | width="90%" | key
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | The secret key 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 |  | 
| − | | width="90%" | ciphertext
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Buffer containing the ciphertext to be decrypted. 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-s16-icon.png]] - INT
 |  | 
| − | | width="90%" style="border-top: 2px solid #000;" | ''Return''
 |  | 
| − | |}
 |  | 
| − |   |  | 
| − |   |  | 
| − | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 |  | 
| − | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''hash_without_key'''
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Creates a hash fingerprint of the data, which will always have the same fingerprint, similar to the MD5 or SHA-1 Returns 0 if successful. 
 |  | 
| − | |-
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 |  | 
| − | | width="90%" | hash
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Buffer for the hash. Size >=32 makes it practically impossible for two messages to produce the same fingerprint. 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 |  | 
| − | | width="90%" | data
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Data buffer to be processed 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 |  | 
| − | | width="90%" | size
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Byte count of data to be processed 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-s16-icon.png]] - INT
 |  | 
| − | | width="90%" style="border-top: 2px solid #000;" | ''Return''
 |  | 
| − | |}
 |  | 
| − |   |  | 
| − |   |  | 
| − |   |  | 
| − |   |  | 
| − | ==Property reference==
 |  | 
| − |   |  | 
| − | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
 |  | 
| − | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties''' 
 |  | 
| − | |-
 |  | 
| − | |}==Macro reference==
 |  | 
| − |   |  | 
|  | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" |  | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | 
|  | |- |  | |- | 
| Line 942: | Line 292: | 
|  |  |  |  | 
|  |  |  |  | 
|  | + | ===sign_keygen=== | 
|  | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" |  | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | 
|  | |- |  | |- | 
|  | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] |  | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | 
| − | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''secretbox_keygen''' | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''sign_keygen''' | 
|  | |- |  | |- | 
| − | | colspan="2" | Creates a secret keysuitable for use with the secretbox functions.You must provide a 32 byte array for the key.  | + | | colspan="2" | Creates Private and Public key pair to sign and verify messages. Returns 0 if successful.  | 
|  | |- |  | |- | 
|  | |- |  | |- | 
|  | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE |  | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | 
| − | | width="90%" | key | + | | width="90%" | Secret | 
| − | |-
 |  | 
| − | | colspan="2" |  
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 |  | 
| − | | width="90%" style="border-top: 2px solid #000;" | ''Return''
 |  | 
| − | |}
 |  | 
| − |   |  | 
| − |   |  | 
| − | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 |  | 
| − | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''hash_with_key'''
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Creates a hash fingerprint of the data, using the given key. Returns 0 if successful. 
 |  | 
|  | |- |  | |- | 
|  | + | | colspan="2" | Buffer to receive the Private/Secret Key. Buffer size must be 64 bytes  | 
|  | |- |  | |- | 
|  | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE |  | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | 
| − | | width="90%" | hash | + | | width="90%" | Public | 
|  | |- |  | |- | 
| − | | colspan="2" | Buffer for the hash. Size >=32 makes it practically impossible for two messages toproduce thesame fingerprint.  | + | | colspan="2" | Buffer to receive the Public key. Buffer size must be 32 bytes  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 |  | 
| − | | width="90%" | data
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | The data buffer to be processed 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 |  | 
| − | | width="90%" | size
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Byte count of the data to beprocessed 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 |  | 
| − | | width="90%" | key
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Key to be used 
 |  | 
|  | |- |  | |- | 
|  | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-s16-icon.png]] - INT |  | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-s16-icon.png]] - INT | 
| Line 993: | Line 316: | 
|  |  |  |  | 
|  |  |  |  | 
|  | + | ===sign_verify=== | 
|  | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" |  | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | 
|  | |- |  | |- | 
| Line 1,024: | Line 348: | 
|  | | width="90%" style="border-top: 2px solid #000;" | ''Return'' |  | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | 
|  | |} |  | |} | 
| − | 
 |  | 
| − | 
 |  | 
| − | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 |  | 
| − | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''init'''
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Initialisation function. To be called at the very start of your program. 
 |  | 
| − | |-
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-s16-icon.png]] - INT
 |  | 
| − | | width="90%" style="border-top: 2px solid #000;" | ''Return''
 |  | 
| − | |}
 |  | 
| − | 
 |  | 
| − | 
 |  | 
| − | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 |  | 
| − | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''sign_keygen'''
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Creates Private and Public key pair to sign and verify messages. Returns 0 if successful. 
 |  | 
| − | |-
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 |  | 
| − | | width="90%" | Secret
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Buffer to receive the Private/Secret Key. Buffer size must be 64 bytes 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 |  | 
| − | | width="90%" | Public
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Buffer to receive the Public key. Buffer size must be 32 bytes 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-s16-icon.png]] - INT
 |  | 
| − | | width="90%" style="border-top: 2px solid #000;" | ''Return''
 |  | 
| − | |}
 |  | 
| − | 
 |  | 
| − | 
 |  | 
| − | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 |  | 
| − | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''secretbox_encrypt'''
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Encrypts a message with a secret key. A single key is used both to encrypt/sign and verify/decrypt messages. For this reason, it is critical to keep the key confidential. Returns 0 on success. 
 |  | 
| − | |-
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 |  | 
| − | | width="90%" | message
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Buffer containing the message to be encrypted. 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 |  | 
| − | | width="90%" | length
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | The length (byte count) of the message 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 |  | 
| − | | width="90%" | ID
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Message ID. Can be 0 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 |  | 
| − | | width="90%" | key
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | The secret key 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 |  | 
| − | | width="90%" | ciphertext
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Buffer for ciphertext output. Buffer size must be at least length + 36 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-s16-icon.png]] - INT
 |  | 
| − | | width="90%" style="border-top: 2px solid #000;" | ''Return''
 |  | 
| − | |}
 |  | 
| − | 
 |  | 
| − | 
 |  | 
| − | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 |  | 
| − | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''hash_keygen'''
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Creates a secret key suitable for use with the hash_hash function. You must provide a 32 byte array for the key. 
 |  | 
| − | |-
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 |  | 
| − | | width="90%" | key
 |  | 
| − | |-
 |  | 
| − | | colspan="2" |  
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 |  | 
| − | | width="90%" style="border-top: 2px solid #000;" | ''Return''
 |  | 
| − | |}
 |  | 
| − | 
 |  | 
| − | 
 |  | 
| − | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 |  | 
| − | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''secretbox_decrypt'''
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Decrypts a message with a secret key. A single key is used both to encrypt/sign and verify/decrypt messages. For this reason, it is critical to keep the key confidential. Returns 0 on success. 
 |  | 
| − | |-
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 |  | 
| − | | width="90%" | message
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Buffer for the decrypted message. Size must be at least length - 36 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 |  | 
| − | | width="90%" | length
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | The length (byte count) of the ciphertext 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 |  | 
| − | | width="90%" | ID
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Message ID. Must match with the original message ID. Can be 0 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 |  | 
| − | | width="90%" | key
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | The secret key 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 |  | 
| − | | width="90%" | ciphertext
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Buffer containing the ciphertext to be decrypted. 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-s16-icon.png]] - INT
 |  | 
| − | | width="90%" style="border-top: 2px solid #000;" | ''Return''
 |  | 
| − | |}
 |  | 
| − | 
 |  | 
| − | 
 |  | 
| − | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 |  | 
| − | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''hash_without_key'''
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Creates a hash fingerprint of the data, which will always have the same fingerprint, similar to the MD5 or SHA-1 Returns 0 if successful. 
 |  | 
| − | |-
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 |  | 
| − | | width="90%" | hash
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Buffer for the hash. Size >=32 makes it practically impossible for two messages to produce the same fingerprint. 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 |  | 
| − | | width="90%" | data
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Data buffer to be processed 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 |  | 
| − | | width="90%" | size
 |  | 
| − | |-
 |  | 
| − | | colspan="2" | Byte count of data to be processed 
 |  | 
| − | |-
 |  | 
| − | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-s16-icon.png]] - INT
 |  | 
| − | | width="90%" style="border-top: 2px solid #000;" | ''Return''
 |  | 
| − | |}
 |  | 
| − | 
 |  | 
| − | 
 |  | 
|  |  |  |  | 
|  |  |  |  |