?login_element?

Subversion Repositories NedoOS

Rev

Blame | Last modification | View Log | Download

  1. // Z80 ciphers test framework
  2. // (c) 2019 lvd^mhm
  3.  
  4. /*
  5.     This file is part of Z80 ciphers test framework.
  6.  
  7.     Z80 ciphers test framework is free software:
  8.     you can redistribute it and/or modify it under the terms of
  9.     the GNU General Public License as published by
  10.     the Free Software Foundation, either version 3 of the License, or
  11.     (at your option) any later version.
  12.  
  13.     Z80 ciphers test framework is distributed in the hope that
  14.     it will be useful, but WITHOUT ANY WARRANTY; without even
  15.     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  16.     See the GNU General Public License for more details.
  17.  
  18.     You should have received a copy of the GNU General Public License
  19.     along with Z80 ciphers test framework.
  20.     If not, see <http://www.gnu.org/licenses/>.
  21. */
  22.  
  23. #ifndef HASH_COMMON_H
  24. #define HASH_COMMON_H
  25.  
  26. // common iface to call any hashes
  27.  
  28. struct hash_iface
  29. {
  30.         void * hash_specific_data; // for a hash, its specific data (like state)
  31.  
  32.         const char * name;
  33.  
  34.         int    (*hash_init)    (struct hash_iface * hash); // 0 is failure
  35.         int    (*hash_start)   (struct hash_iface * hash); // 0 is failure
  36.         int    (*hash_addbytes)(struct hash_iface * hash, const uint8_t * message, size_t size); // 0 is failure
  37.         size_t (*hash_getsize) (struct hash_iface * hash); // returns size of the result in bytes
  38.         int    (*hash_result)  (struct hash_iface * hash, uint8_t * result); // 0 is failure. result is written at the given pointer
  39.  
  40.         void (*hash_deinit)(struct hash_iface * hash);
  41. };
  42.  
  43.  
  44.  
  45.  
  46.  
  47. #endif // HASH_COMMON_H
  48.  
  49.