hash_plugins_list = [
  'md2',
  'md4',
  'md5',
  'sha1',
  'sha256',
  'sha384',
  'sha512',
  'sha3_224',
  'sha3_256',
  'sha3_384',
  'sha3_512',
  'keccak_256',
  'keccak_384',
  'keccak_512',
  'shake_128',
  'shake_256',
  'murmur3_x86_32',
  'murmur3_x86_128',
  'murmur3_x64_128',
  'sm3',
  'blake2b',
  'blake2bp',
  'blake2xb',
  'blake2s',
  'blake2sp',
  'blake2xs',
  'blake3',
  'fletcher8',
  'fletcher16',
  'fletcher32',
  'fletcher64',
  'fnv1a',
  'adler32',
  'mod255',
  'crca_crc8smbus',
  'crca_crc8cdma2000',
  'crca_crc8darc',
  'crca_crc8dvbs2',
  'crca_crc8ebu',
  'crca_crc8icode',
  'crca_crc8itu',
  'crca_crc8maxim',
  'crca_crc8rohc',
  'crca_crc8wcdma',
  'crca_crc15can',
  'crca_crc16',
  'crca_crc16citt',
  'crca_crc16usb',
  'crca_crc16hdlc',
  'crca_crc16augccitt',
  'crca_crc16buypass',
  'crca_crc16cdma2000',
  'crca_crc16dds110',
  'crca_crc16dectr',
  'crca_crc16dectx',
  'crca_crc16dnp',
  'crca_crc16en13757',
  'crca_crc16genibus',
  'crca_crc16maxim',
  'crca_crc16mcrf4xx',
  'crca_crc16riello',
  'crca_crc16t10dif',
  'crca_crc16teledisk',
  'crca_crc16tms37157',
  'crca_crca',
  'crca_crc16kermit',
  'crca_crc16modbus',
  'crca_crc16x25',
  'crca_crc16xmodem',
  'crca_crc24',
  'crca_crc32',
  'crca_crc32ecma267',
  'crca_crc32c',
  'crca_crc32bzip2',
  'crca_crc32d',
  'crca_crc32mpeg2',
  'crca_crc32posix',
  'crca_crc32q',
  'crca_crc32jamcrc',
  'crca_crc32xfer',
  'crca_crc64',
  'crca_crc64ecma182',
  'crca_crc64we',
  'crca_crc64xz',
  'crca_crc64iso',
  'jenkins',
  'xor8',
  'xor16',
  'xxhash32',
  'xxhash64',
  'ssdeep',
  'parity',
  'entropy',
  'entropy_fract',
  'temperature',
  'chisquare',
  'ioc',
  'minentropy',
  'serialcorr',
]

hash_plugins = {
  'base_name': 'rz_hash',
  'base_struct': 'RzHashPlugin',
  'list': hash_plugins_list,
}

rz_hash_sources = [
  'hash.c',
  'randomart.c',
  'p/algo_crca.c',
  'p/algo_adler32.c',
  'p/algo_fletcher.c',
  'p/algo_fnv1a.c',
  'p/algo_blake2b.c',
  'p/algo_blake2bp.c',
  'p/algo_blake2xb.c',
  'p/algo_blake2s.c',
  'p/algo_blake2sp.c',
  'p/algo_blake2xs.c',
  'p/algo_blake3.c',
  'p/algo_sm3.c',
  'p/algo_md2.c',
  'p/algo_md4.c',
  'p/algo_md5.c',
  'p/algo_mod255.c',
  'p/algo_sha1.c',
  'p/algo_sha256.c',
  'p/algo_sha384.c',
  'p/algo_sha512.c',
  'p/algo_sha3_224.c',
  'p/algo_sha3_256.c',
  'p/algo_sha3_384.c',
  'p/algo_sha3_512.c',
  'p/algo_keccak_256.c',
  'p/algo_keccak_384.c',
  'p/algo_keccak_512.c',
  'p/algo_shake_128.c',
  'p/algo_shake_256.c',
  'p/algo_murmur3_x64_128.c',
  'p/algo_murmur3_x86_32.c',
  'p/algo_murmur3_x86_128.c',
  'p/algo_jenkins.c',
  'p/algo_xor8.c',
  'p/algo_xor16.c',
  'p/algo_xxhash32.c',
  'p/algo_xxhash64.c',
  'p/algo_ssdeep.c',
  'p/algo_parity.c',
  'p/algo_entropy.c',
  'p/algo_entropy_fractional.c',
  'p/algo_temperature.c',
  'p/algo_chisquare.c',
  'p/algo_ioc.c',
  'p/algo_minentropy.c',
  'p/algo_serialcorr.c',
  'algorithms/mod255/mod255.c',
  'algorithms/parity/parity.c',
  'algorithms/entropy/entropy.c',
  'algorithms/temperature/temperature.c',
  'algorithms/chisquare/chisquare.c',
  'algorithms/ioc/ioc.c',
  'algorithms/minentropy/minentropy.c',
  'algorithms/serialcorr/serialcorr.c',
  'algorithms/adler32/adler32.c',
  'algorithms/crc/crca.c',
  'algorithms/xor/xor.c',
  'algorithms/fletcher/fletcher.c',
  'algorithms/ssdeep/ssdeep.c',
  'algorithms/md2/md2.c',
  'algorithms/sha3/sha3.c',
  'algorithms/shake/shake.c',
  'algorithms/murmur3/murmur3.c',
]

dependencies = [mth, rz_util_dep, xxhash_dep, blake3_dep, blake2_dep]

if sys_openssl.found()
  dependencies += [sys_openssl]
else
  rz_hash_sources += [
    'algorithms/md4/md4.c',
    'algorithms/md5/md5.c',
    'algorithms/sha1/sha1.c',
    'algorithms/sha2/sha2.c',
  ]
endif

if userconf.get('HAVE_OPENSSL_SM3', 0) == 0
  rz_hash_sources += [
    'algorithms/sm3/sm3.c',
  ]
endif

rz_hash = library('rz_hash', rz_hash_sources,
  include_directories: [platform_inc],
  dependencies: dependencies,
  install: true,
  implicit_include_directories: false,
  install_rpath: rpath_lib,
  soversion: rizin_libversion,
  version: rizin_version,
  name_suffix: lib_name_suffix,
  name_prefix: lib_name_prefix,
)

rz_hash_dep = declare_dependency(link_with: rz_hash,
                                include_directories: [platform_inc])
meson.override_dependency('rz_hash', rz_hash_dep)

modules += { 'rz_hash': {
    'target': rz_hash,
    'dependencies': ['rz_util'],
    'plugins': [hash_plugins]
}}
