ca1203407010c9b904cd30ed1318db792c433e94 — Emery Hemingway 1 year, 11 months ago b1b869b
Add hash procedure
1 files changed, 6 insertions(+), 1 deletions(-)

M src/toxcore.nim
M src/toxcore.nim => src/toxcore.nim +6 -1
@@ 113,6 113,7 @@ template toxArrayType(name, N: untyped) =
toxArrayType(PublicKey, TOX_PUBLIC_KEY_SIZE)
toxArrayType(SecretKey, TOX_SECRET_KEY_SIZE)
toxArrayType(Address, TOX_ADDRESS_SIZE)
toxArrayType(Hash, TOX_HASH_LENGTH)
toxArrayType(FileId, TOX_FILE_ID_LENGTH)
toxArrayType(ConferenceId, TOX_CONFERENCE_ID_SIZE)
toxArrayType(ConferenceUid, TOX_CONFERENCE_UID_SIZE)

@@ 845,7 846,11 @@ callbackSetter friend_message:
      length: csize; user_data: pointer) {.cdecl.} =
    callThru(friend, ctoxString(message, length), kind)

proc hash(hash: ptr uint8; data: ptr uint8; length: csize): bool {.ctoxProc.}
proc hash*(data: pointer; size: int): Hash =
  ## Generate cryptographic hash of the given data,
  ## provided primarily for validating cached avatars.
  proc hash(hash: ptr uint8; data: pointer; length: csize): bool {.ctoxProc.}
  discard hash(addr result.bytes[0], data, size)

type Tox_Err_File_Control = enum