Exemplo n.º 1
0
        /// <summary>
        /// Generates a cryptographic hash of the given data.
        /// </summary>
        /// <param name="data">The data to calculate the hash of.</param>
        /// <returns>The cryptographic hash of the given data.</returns>
        public static byte[] Hash(byte[] data)
        {
            if (data == null)
            {
                throw new ArgumentNullException("data");
            }

            byte[] hash = new byte[ToxConstants.HashLength];
            ToxFunctions.Hash(hash, data, (uint)data.Length);
            return(hash);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Checks whether or not this version is compatible with the version of Tox that we're using.
 /// </summary>
 /// <returns>True if this version is compatible, false if it's not.</returns>
 public bool IsCompatible()
 {
     return(ToxFunctions.VersionIsCompatible((uint)Major, (uint)Minor, (uint)Patch));
 }
Exemplo n.º 3
0
 /// <summary>
 /// Executes tox_kill to free the tox handle.
 /// </summary>
 /// <returns></returns>
 protected override bool ReleaseHandle()
 {
     ToxFunctions.Kill(handle);
     return(true);
 }