Check-in [1f25119683]
Not logged in
Overview
Comment:rhash
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 1f25119683cfd7496287a2dc035a1c9273c82da2
User & Date: vhost7825ssh on 2018-06-14 15:26:23
Other Links: manifest | tags
Context
2018-06-19 17:03
Sinalgo, ns3, etc. check-in: a14540dfb7 user: vhost7825ssh tags: trunk
2018-06-14 15:26
rhash check-in: 1f25119683 user: vhost7825ssh tags: trunk
2018-03-26 14:38
distributed storage Sia check-in: d2518924bd user: martin_vahi tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/COMMENTS.txt version [d11da32b6d].

            1  +
            2  +Download page:
            3  +
            4  +    https://sourceforge.net/projects/rhash/files/rhash/1.3.6/
            5  +

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/.gitignore version [4099162c37].

            1  +/dist/rhash.spec
            2  +/dist/rhash.1.*
            3  +/dist/librhash.pc
            4  +/librhash/exports.sym
            5  +po/*.gmo
            6  +/rhash
            7  +/rhash_shared
            8  +/rhash_static
            9  +/librhash/test_shared
           10  +/librhash/test_static
           11  +config.mak
           12  +*.[ao]
           13  +*.exe
           14  +*.dll
           15  +*.def
           16  +*.so
           17  +*.so.0
           18  +*.log

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/COPYING version [50aa3a8f41].

            1  +
            2  +                                RHash License
            3  +
            4  +Copyright (c) 2005-2014 Aleksey Kravchenko <rhash.admin@gmail.com>
            5  +
            6  +Permission is hereby granted, free of charge,  to any person obtaining a copy
            7  +of this software and associated documentation files (the "Software"), to deal
            8  +in the Software without restriction,  including without limitation the rights
            9  +to  use,  copy,  modify,  merge, publish, distribute, sublicense, and/or sell
           10  +copies  of  the Software,  and  to permit  persons  to whom  the Software  is
           11  +furnished to do so.
           12  +
           13  +The Software  is distributed in the hope that it will be useful,  but WITHOUT
           14  +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
           15  +FOR A PARTICULAR PURPOSE.  Use  this  program  at  your  own  risk!

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/ChangeLog version [fdc5e77414].

            1  +Wed 14 Mar 2018 Aleksey
            2  +	* === Version 1.3.6 ===
            3  +	* support --file-list option
            4  +
            5  +Sun 11 Mar 2018 And Sch
            6  +	* librhash: speedup sha3
            7  +
            8  +Sun Feb 18 2018 Aleksey
            9  +	* Bugfix: fix --follow option
           10  +
           11  +Mon Jan 29 2018 J. Peter Mugaas
           12  +	* better MSYS and CygWin support
           13  +
           14  +Fri Jan 26 2018 Aleksey
           15  +	* configuration script
           16  +
           17  +Mon Sep  4 2017 Aleksey
           18  +	* Bugfix: broken binary hash output
           19  +
           20  +Mon Aug 28 2017 Aleksey
           21  +	* Bugfix: fix running on WinXP
           22  +
           23  +Mon Aug 14 2017 Aleksey
           24  +	* === Version 1.3.5 ===
           25  +	* look for locales directory at PROGRAM_DIRECTORY\locale on Windows
           26  +	* look for config at PROGRAM_DIRECTORY\rhashrc on Windows
           27  +
           28  +Fri Aug  4 2017 Aleksey
           29  +	* support LibRhash bindings to PHP7
           30  +
           31  +Sun Jul 30 2017 Aleksey
           32  +	* Bugfix: illegal instruction error on macOS
           33  +
           34  +Sat Jul 29 2017 Aleksey
           35  +	* improve utf-8 support on Windows
           36  +
           37  +Thu Jul 27 2017 Aleksey
           38  +	* Bugfix: fix access to long paths on Windows
           39  +
           40  +Mon Jul 17 2017 Aleksey
           41  +	* add ca, fr, ro translations
           42  +
           43  +Sun Jul 16 2017  Darío Hereñú
           44  +	* full Spanish translation
           45  +
           46  +Mon Jul 10 2017 James Le Cuirot
           47  +	* correct build/install command for freebsd
           48  +
           49  +Mon Jul 10 2017 Przemyslaw Pawelczyk
           50  +	* compilation fixes for aarch64 and musl
           51  +
           52  +Mon Jul 10 2017 Aleksey
           53  +	* improve support of clang on macOS
           54  +
           55  +Sun Nov  6 2016 Aleksey
           56  +	* === Version 1.3.4 ===
           57  +
           58  +Tue Nov 17 2015 Alexey Dokuchaev, Kurt Jaeger
           59  +	* compilation fixes for FreeBSD
           60  +
           61  +Sat Aug  9 2014 Aleksey
           62  +	* return non zero exit code if a file was not found
           63  +
           64  +Tue Aug  5 2014 Aleksey
           65  +	* === Version 1.3.3 ===
           66  +
           67  +Mon Aug  4 2014 And Sch, Aleksey
           68  +	* librhash: small optimization of Whirlpool
           69  +
           70  +Sat Aug  2 2014 Aleksey
           71  +	* option --exclude for skipping some files during recursive scanning
           72  +
           73  +Fri Aug  1 2014 Aleksey
           74  +	* update the SHA3 algorithm to follow the changes of the FIPS 202 draft
           75  +
           76  +Wed Jul 30 2014 Aleksey
           77  +	* support torrents with more than one announce url
           78  +
           79  +Tue Jul 29 2014 Aleksey
           80  +	* LibRHash now exports torrent functions
           81  +
           82  +Mon Jul 21 2014 Tsukasa Oi
           83  +	* fixed test_rhash.sh script failing on the en_US.UTF-8 locale
           84  +
           85  +Wed Jul 16 2014 Aleksey
           86  +	* changed the `-p' format names of sha* families, see manpage
           87  +	* set a boolean in config to true by a string `true', `on' or `yes'
           88  +
           89  +Sun Jul 13 2014 Aleksey
           90  +	* Ctrl-C now interrupts benchmarking
           91  +
           92  +Wed Jul  2 2014 Aleksey
           93  +	* === Version 1.3.2 ===
           94  +
           95  +Sat Jun 21 2014 Aleksey
           96  +	* report warnings on files locked by some processes
           97  +
           98  +Thu Jun 19 2014 Brad Campbell
           99  +	* ignore non-regular files while scanning directories recursively
          100  +
          101  +Wed Jun 18 2014 Aleksey
          102  +	* option --follow for following symlinks to directories
          103  +
          104  +Sun Apr 13 2014 ZinnKid
          105  +	* BTIH piece length calculation updated to follow the uTorrent algorithm change
          106  +
          107  +Wed Jan  8 2014 Aleksey
          108  +	* === Version 1.3.1 ===
          109  +	* Exclude the files specified by -o and -l from processing
          110  +
          111  +Sat Jan  4 2014 Aleksey
          112  +	* Improved directory scanning
          113  +
          114  +Sat Dec 28 2013 Aleksey
          115  +	* Bugfix: suppress the R6034 error popup on Windows
          116  +
          117  +Fri Oct 25 2013 Aleksey
          118  +	* Fixed 'value too large' error on 32-bit Linux
          119  +
          120  +Thu Sep 19 2013 Aleksey
          121  +	* Bugfix: corrected sha3-224 for big-endian processors
          122  +
          123  +Tue Sep 17 2013 Aleksey
          124  +	* === Version 1.3.0 ===
          125  +
          126  +Tue May 21 2013 Aleksey
          127  +	* Fixed output of percents when two or more files are hashed
          128  +
          129  +Mon Apr 29 2013 Aleksey
          130  +	* Supported SHA3 (Keccak) hash function
          131  +
          132  +Sat Apr 27 2013 Aleksey
          133  +	* Fixed memory leaks
          134  +
          135  +Tue Apr 23 2013 Aleksey
          136  +	* Bugfix: %{mtime} formatting option was broken
          137  +
          138  +Mon Dec 31 2012 Aleksey
          139  +	* imported translations from Launchpad: de, es, gl, it
          140  +
          141  +Tue Dec 25 2012 Aleksey
          142  +	* === Version 1.2.10 ===
          143  +
          144  +Mon Nov  5 2012 Aleksey
          145  +	* Bugfix: incorrect GOST hash for ("\FF" x 64) on non-x86 CPU
          146  +
          147  +Mon Oct  8 2012 Aleksey
          148  +	* Shortcut -k for --check-embedded
          149  +
          150  +Thu Sep 27 2012 Aleksey
          151  +	* Bugfix: non-zero exit code if some files were not found
          152  +	* improved Ctrl-C processing
          153  +
          154  +Sat Aug  4 2012 Aleksey
          155  +	* Bugfix: path issue with verification of hash files
          156  +
          157  +Mon Jun 25 2012 Aleksey
          158  +	* Bugfix: different BTIH were generated for the same file
          159  +
          160  +Sun May 13 2012 Aleksey
          161  +	* BugFix: python crashed on ia64
          162  +
          163  +Tue Apr 17 2012 Aleksey
          164  +	* PHP bindings for librhash
          165  +
          166  +Sat Apr 14 2012 Aleksey
          167  +	* === Version 1.2.9 ===
          168  +
          169  +Fri Apr 13 2012 Aleksey, Sergey Basalaev
          170  +	* translations: de, en_AU, es, gl, it
          171  +
          172  +Sun Apr 08 2012 Aleksey
          173  +	* Bugfix: handling UNC filenames on Windows
          174  +	* option --bt-batch for batch torrents
          175  +
          176  +Sat Jan  7 2012 Aleksey
          177  +	* librhash: rhash_print_magnet function
          178  +
          179  +Sun Nov 06 2011 Sergey Basalaev
          180  +	* .NET/Mono bindings to librhash
          181  +
          182  +Wed Sep 14 2011 Aleksey
          183  +	* === Version 1.2.8 ===
          184  +
          185  +Wed Sep 14 2011 Aleksey, SBasalaev
          186  +	* LibRHash bindings to Java, Perl, Python, Ruby
          187  +
          188  +Tue Sep  6 2011 Aleksey
          189  +	* librhash: implemented auto-final feature, turned on by default
          190  +
          191  +Tue Sep  6 2011 Aleksey, SBasalaev
          192  +	* Russian translation
          193  +
          194  +Sat Sep  3 2011 Aleksey
          195  +	* Bugfix: not enough trailing '=' in a base64-encoded hash
          196  +
          197  +Sat Aug 20 2011 Aleksey
          198  +	* Bugfix: fix broken --openssl option parsing
          199  +	* Bugfix: buffer overflow when using --embed-crc-delimiter
          200  +	* Bugfix: segmentation fault on SUSE Linux
          201  +
          202  +Sun Aug 14 2011 Aleksey
          203  +	* === Version 1.2.7 ===
          204  +
          205  +Sun Aug  7 2011 Aleksey
          206  +	* Bugfix: percents option was broken in v1.2.6
          207  +
          208  +Fri Aug  5 2011 Aleksey
          209  +	* supported verification of sha256, sha512 and other hash sums
          210  +
          211  +Mon Jul 11 2011 Aleksey
          212  +	* librhash: rhash_cancel() macro to cancel hashing from another thread
          213  +
          214  +Fri Jun 24 2011 Aleksey
          215  +	* Bugfix: repaired default output encoding to be UTF-8 on Windows
          216  +
          217  +Wed Jun 22 2011 Aleksey
          218  +	* Bugfix: crash on WinXP
          219  +
          220  +Thu Jun 16 2011 Aleksey
          221  +	* === Version 1.2.6 ===
          222  +
          223  +Sat Jun 11 2011 Aleksey
          224  +	* allowed options to be intermixed with file names in arbitrary order
          225  +	* switched option -G and the '%G' printf pattern to print GOST hash
          226  +	* Bugfix: --output failed for cyrillic file name
          227  +
          228  +Wed Jun  8 2011 Aleksey
          229  +	* librhash: better shared library compilation/testing support
          230  +
          231  +Mon Jun  6 2011 Aleksey
          232  +	* librhash: exported benchmarking functions in the shared library
          233  +	* librhash: added prefix to all functions to avoid poluting linker namespace
          234  +	* librhash: fixed rare alignment bugs in rhash_print and EDON-R 512
          235  +
          236  +Sat May 28 2011 Aleksey
          237  +	* librhash: loading openssl at runtime if it is present
          238  +	* Bugfix: LLVM GOST amd64 asm compilation error
          239  +
          240  +Wed May 18 2011 Aleksey
          241  +	* === Version 1.2.5 ===
          242  +	* option --openssl allows to replace some algorithms by the OpenSSL ones
          243  +	* Bugfix: incorrect recursive traversing of very long UTF-8 filepaths
          244  +
          245  +Wed Apr 27 2011 Aleksey
          246  +	* Bugfix: corrected calculation of BTIH hash and torrent files
          247  +
          248  +Fri Apr 15 2011 Aleksey
          249  +	* === Version 1.2.4 ===
          250  +	* option --benchmark-raw for machine-readable benchmark output format
          251  +	* on Intel/AMD CPUs benchmark now prints the clocks-per-byte value
          252  +
          253  +Tue Apr  5 2011 Aleksey
          254  +	* changed config file locations
          255  +
          256  +Fri Apr  1 2011 Aleksey
          257  +	* Bugfix: repaired --path-separator on linux/unix
          258  +
          259  +Sun Mar 27 2011 Aleksey
          260  +	* === Version 1.2.3 ===
          261  +
          262  +Fri Mar 25 2011 Aleksey
          263  +	* one-line percent for linux/unix
          264  +
          265  +Mon Mar 14 2011 Aleksey
          266  +	* added printf modificator %{mtime} to print the last modified date of a file
          267  +
          268  +Thu Feb 17 2011 Aleksey
          269  +	* Bugfix: verification of base2-like formatted md5 hash sums
          270  +
          271  +Fri Jan 14 2011 Aleksey
          272  +	* === Version 1.2.2 ===
          273  +	* one-line percents (windows only)
          274  +
          275  +Tue Jan 11 2011 Aleksey
          276  +	* supported EDON-R 256/512 hash sums
          277  +
          278  +Sun Dec 19 2010 Aleksey
          279  +	* increased process priority when benchmarking on windows
          280  +
          281  +Thu Dec 16 2010 Aleksey
          282  +	* Bugfix: eight hash sums were broken on PowerPC
          283  +	* Bugfix: --accept/--crc-accept were not working since 1.1.9
          284  +
          285  +Tue Dec 14 2010 Aleksey
          286  +	* === Version 1.2.1 ===
          287  +	* Bugfix: GOST broken on OpenSolaris since 1.2.0
          288  +	* option --list-hashes: list names of all supported hashes, one per line
          289  +
          290  +Mon Nov 29 2010 Aleksey
          291  +	* SHA 224/256/384/512 hash functions supported
          292  +	* Bugfix: broken asm compilation on openbsd and freebsd
          293  +
          294  +Wed Nov 24 2010 Aleksey
          295  +	* option --path-separator=<character> for directories scanning
          296  +
          297  +Sun Nov 14 2010 Aleksey
          298  +	* === Version 1.2.0 ===
          299  +	* --gost-cryptopro option: calculate GOST with CryptoPro parameters
          300  +	* --gost-reverse option: reverse bytes in GOST hash sum
          301  +	* Bugfix: btih/gost/ripemd/has160/snefru were not verified correctly in bsd and magnet formats
          302  +
          303  +Fri Oct 29 2010 Aleksey
          304  +	* Bugfix: rhash compiled by MS VC skipped files of size >4Gb
          305  +
          306  +Fri Oct 15 2010 Aleksey
          307  +	* === Version 1.1.9 ===
          308  +	* new interface for internal library librhash
          309  +
          310  +Mon Jul  5 2010 Ruslan Nikolaev
          311  +	* GOST algorithm x86-64 assembler optimization
          312  +
          313  +Sun Apr 25 2010 Aleksey
          314  +	* new options --uppercase and --lowercase
          315  +	* Bugfix: GOST worked incorrectly when compiled by GCC with `-O0'
          316  +
          317  +Wed Apr 21 2010 Aleksey
          318  +	* windows distribution updated
          319  +
          320  +Fri Apr 16 2010 Aleksey
          321  +	* BugFix: options with string values were incorrectly loaded from config
          322  +
          323  +Wed Apr 14 2010 Aleksey
          324  +	* === Version 1.1.8 ===
          325  +	* option --template=<file> to read printf-like template from <file>
          326  +
          327  +Mon Apr 12 2010 Xiangli Huang
          328  +	* BugFix: `--recursive *' traversed parent directory .. under windows
          329  +	* BugFix: `--check <dirname>' reported strange warning for dirs
          330  +
          331  +Mon Apr 12 2010 Aleksey
          332  +	* printf-directives starting with capital letter print upper-cased hashes, e.g. %{Gost}
          333  +	* %u directive switched to print url-encoded filename (alias for %{urlname})
          334  +	* ed2k links verification supported
          335  +
          336  +Fri Apr  9 2010 Aleksey
          337  +	* BugFix: linking problem on OpenSolaris
          338  +	* filenames in urls are now always utf8-encoded (Windows only fix)
          339  +
          340  +Wed Apr  7 2010 Aleksey
          341  +	* '%B','%@' modifiers to print base64/raw representation of any hash (e.g. '%BM')
          342  +
          343  +Wed Mar 31 2010 Aleksey
          344  +	* === Version 1.1.7 ===
          345  +	* option --btih to print BitTorrent infohash
          346  +	* option --torrent to create torrent file
          347  +	* option --bt-private for private torrents
          348  +	* option --bt-piece-length to change torrent piece length
          349  +	* option --bt-announce to set torrent announcement url
          350  +
          351  +Tue Mar 30 2010 Aleksey
          352  +	* the -m option made to be an alias for --magnet
          353  +
          354  +Mon Mar 29 2010 Xiangli Huang
          355  +	* print program version, when benchmarking
          356  +
          357  +Fri Mar 26 2010 Aleksey
          358  +	* Bugfix: infite loop while recursively updating hash files under Windows
          359  +
          360  +Thu Mar  4 2010 Aleksey
          361  +	* maxdepth parameter now is checked to be a number
          362  +
          363  +Thu Feb 25 2010 Aleksey
          364  +	* output tiger hash in the big-endian order
          365  +
          366  +Wed Feb 24 2010 Aleksey
          367  +	* === Version 1.1.6 ===
          368  +	* man page updated
          369  +	* now all supported hashes are verified when cheking magnet links
          370  +	* benchmark now reports the size of the hashed message
          371  +
          372  +Fri Feb 19 2010 Aleksey
          373  +	* Bugfix: fixed GOST for big-endian systems
          374  +
          375  +Wed Feb 17 2010 Aleksey
          376  +	* Bugfix: buffer owerflow while parsing long command line under Windows
          377  +
          378  +Sun Feb 14 2010 Aleksey
          379  +	* Bugfix: fixed HAS-160 for big-endian systems
          380  +
          381  +Wed Feb  3 2010 Aleksey
          382  +	* Bugfix: crash while printing sfv header for files modified before 1970
          383  +
          384  +Fri Jan 29 2010 Aleksey
          385  +	* Bugfix: sfv-hash symlink now sets default print format to SFV
          386  +	* Bugfix: ed2k-link symlink did not work as expected
          387  +
          388  +Thu Jan 28 2010 Aleksey
          389  +	* === Version 1.1.5 ===
          390  +	* option --utf8 under Windows, also UTF8 now is the default encoding
          391  +	* Bugfix: non-existing files were reported twice in `-r --sfv' mode
          392  +
          393  +Wed Jan 27 2010 Aleksey
          394  +	* option --embed-crc-delimiter=<char> to insert <char> before a crc sum in -e mode
          395  +	* alias -e for --embed-crc
          396  +	* alias -B for --benchmark
          397  +
          398  +Mon Jan 11 2010 Aleksey
          399  +	* Bugfix: percents output fixed for files of more than 4Gb of data
          400  +
          401  +Fri Dec 18 2009 Aleksey
          402  +	* AICH algorithm has been re-written to process files of unknown size like stdin, pipes, sockets
          403  +	* ED2K switched to use eMule algorithm when filesize is an exact multiple of 9728000 bytes
          404  +
          405  +Thu Dec 17 2009 Aleksey
          406  +	* Bugfix: buffer overflow when printing eDonkey links for 0-sized files
          407  +	* Bugfix: --ripemd160 and --md4 option were broken
          408  +	* added `%R' printf entity for RIPEMD-160
          409  +
          410  +Mon Dec 14 2009 Aleksey
          411  +	* === Version 1.1.4 ===
          412  +	* supported algorithms: RIPEMD-160, HAS-160, GOST, MD4, SNEFRU-128, SNEFRU-256
          413  +	* long printf format entities, e.g. %{md4}, %{has160}, %{gost}, %{snefru256}
          414  +	* `u' printf modifier for uppercase hashes, e.g. %u{gost}
          415  +	* switched to %{urlname} printf-entity for url-encoded file name
          416  +	* useful symlinks are installed by `make install-symlinks'
          417  +
          418  +Sun Dec  6 2009 Aleksey
          419  +	* WHIRLPOOL hash function supported, option --whirlpool
          420  +
          421  +Wed Dec  2 2009 Aleksey
          422  +	* print file checking statistics when --check-embedded specified
          423  +
          424  +Sun Nov 29 2009 Aleksey
          425  +	* === Version 1.1.3 ===
          426  +	* forbid simultaneous usage of --check, --update and --check-embedded options
          427  +
          428  +Sun Nov 22 2009 Aleksey
          429  +	* Bugfix: Checking of md5 file always reported OK
          430  +	* --check-embedded option to verify files by crc32 sum embedded in their names.
          431  +	* --embed-crc option to rename processed files by embedding crc32 sum into name.
          432  +
          433  +Mon Nov  9 2009 Aleksey
          434  +	* --benchmark option now prints names of tested hash sums
          435  +	* use magnet format as default if the program name contains 'magnet'
          436  +
          437  +Wed Jun 24 2009 Aleksey
          438  +	* supported checking of files containing a single hash sum without a filename
          439  +
          440  +Mon Jun 15 2009 Aleksey
          441  +	* === Version 1.1.2 ===
          442  +	* verification of files with magnet links supported
          443  +
          444  +Wed May 20 2009 Aleksey
          445  +	* Bugfix: --skip-ok was broken since 1.1.0
          446  +
          447  +Fri May 15 2009 Aleksey
          448  +	* Bugfix: checking of ed2k hashes was broken since version 1.1.0
          449  +	* Bugfix: --verbose lead to crash under OpenSolaris when config file not present
          450  +
          451  +Mon Mar 23 2009 Aleksey
          452  +	* === Version 1.1.1 ===
          453  +	* config file described in the man page
          454  +	* Bugfix: buffer owerflow when printing tiger hash
          455  +
          456  +Sat Mar 21 2009 Aleksey
          457  +	* Bugfix: some options couldn't be read from config file
          458  +
          459  +Sat Mar 14 2009 Aleksey
          460  +	* === Version 1.1.0 ===
          461  +	* various small changes and refactoring
          462  +
          463  +Tue Mar 10 2009 Aleksey
          464  +	* option --speed to print per-file and total speed statistics
          465  +
          466  +Thu Mar  5 2009 Aleksey
          467  +	* option --output to write calculation and check results to a file
          468  +	* option --log to log percents, speed and verbose messages
          469  +
          470  +Wed Mar  4 2009 Aleksey
          471  +	* option --percents to show wget-like percents
          472  +
          473  +Tue Feb 26 2009 Aleksey
          474  +	* Bugfix: fixed processing of unaligned messages in the get_crc32() function
          475  +
          476  +Sat Feb 14 2009 Aleksey
          477  +	* === Version 1.0.8 ===
          478  +	* --magnet option supported to format sums as a magnet link
          479  +	* Bugfix: printf option from config conflicted with command line
          480  +
          481  +Sun Dec 14 2008 Aleksey
          482  +	* === Version 1.0.7 ===
          483  +	* config file supported to load default options values
          484  +	* if --verbose, report verification errors as "sum is XXXXXXXX, should be YYYYYYYY"
          485  +	* '%h' modifier changed to '%x'
          486  +
          487  +Fri Nov 14 2008 Aleksey
          488  +	* === Version 1.0.6 ===
          489  +	* reg-file for FAR user menu
          490  +
          491  +Thu Oct  9 2008 Aleksey
          492  +	* interpret '#' symbol as a comment
          493  +
          494  +Sat Sep 20 2008 ivan386
          495  +	* under windows skip files openned for writing
          496  +	* Bugfix: printf arguments %p and %f corrected
          497  +
          498  +Sun Sep 14 2008 Aleksey
          499  +	* === Version 1.0.5 ===
          500  +
          501  +Wed Aug  6 2008 Aleksey
          502  +	* '%b','%h' modifiers to print base32/hex representation of any hash (e.g. '%bH')
          503  +	* supported -p '\0' symbol
          504  +	* supported setting width for filesizes (e.g. -p '%12s')
          505  +
          506  +Tue Jul 22 2008 Aleksey
          507  +	* --verbose prints read speed statistics to stderr after each file
          508  +	* read buffer increased to 2 MiB
          509  +
          510  +Wed Jul 9 2008 Aleksey
          511  +	* === Version 1.0.4 ===
          512  +	* '%u' prints URL-encoded filename
          513  +	* EDonkey links now have URL-encoded filename and contain AICH hash
          514  +
          515  +Mon Jul 7 2008 Aleksey
          516  +	* AICH hashsums supported, option --aich
          517  +
          518  +Sat Jun 28 2008 Aleksey
          519  +	* === Version 1.0.3 ===
          520  +	* ed2k calculation fixed for files with 9728000 < filesize <= 9732096
          521  +	* Big-endian processors supported for all sums
          522  +
          523  +Sat Jun 14 2008 Aleksey
          524  +	* === Version 1.0.2 ===
          525  +
          526  +Fri Jun 6 2008 Aleksey
          527  +	* --benchmark option added
          528  +	* skip locked files under win32 when calculating 'em sums
          529  +
          530  +Tue May 20 2008 Aleksey
          531  +	* Bugfix: updating of md5 files was broken
          532  +	* Bugfix: more rigid parsing of base32/hex hash sums
          533  +
          534  +Wed May 15 2008 Aleksey
          535  +	* === Version 1.0.1 ===
          536  +	* Bugfix: last line without '\n' couldn't be parsed
          537  +
          538  +Wed May 14 2008 Aleksey
          539  +	* Bugfix: empty lines were not skipped, when verifying a crc file
          540  +	* option '--skip-ok' to skip OK messages for successfuly verified files
          541  +
          542  +Tue Jan 22 2008 Aleksey
          543  +	* option '-a' to print all supported hash sums
          544  +	* Changed default behavior: if no formatting option are set, sfv header is printed only for --crc32
          545  +
          546  +Wed Dec 19 2007 Aleksey
          547  +	* Bugfix: fixed buffer overflow for command line -p '%%%%d'
          548  +	* Bugfix: fixed size calculation for stdin (rhash -p '%s' - <file)
          549  +
          550  +Fri Dec 14 2007 Aleksey
          551  +	* === Version 1.0 ===
          552  +	* large files (more then 4Gb) supported
          553  +
          554  +Thu Sep 13 2007 Aleksey
          555  +	* === Version 0.9.2 ===
          556  +
          557  +Tue Sep 11 2007 Aleksey
          558  +	* Checking of TTH sums supported
          559  +
          560  +Mon Sep 10 2007 Aleksey
          561  +	* Bugfix: ignore path delimiters at the end of filenames under win32
          562  +
          563  +Sun May 27 2007 Aleksey
          564  +	* === Version 0.9.1 ===
          565  +	* Tiger option changed to -G
          566  +	* Supported parsing of windows-style paths in crc files under linux
          567  +
          568  +Sat May 26 2007 Aleksey
          569  +	* TTH hash function supported (see -T option)
          570  +
          571  +Thu May 17 2007 Aleksey
          572  +	* Bugfix: --printf="%f" under Windows printed paths instead of filenames
          573  +
          574  +Sun May 13 2007 Aleksey
          575  +	* === Version 0.9 ===
          576  +	* program renamed to rhash
          577  +	* md5/sha1/ed2k code rewrited and slightly optimized
          578  +	* Bugfix: repaired parsing of crc files with tiger hash
          579  +
          580  +Fri May 11 2007 Aleksey
          581  +	* === Version 0.8.9 ===
          582  +	* Bugfix: fixed broken md5 and ed2k sums verification
          583  +
          584  +Sun May 06 2007 Aleksey
          585  +	* Bugfix: fixed wrong Tiger hash calculation for files with (file_size % 64) >= 56
          586  +	* Tiger hash optimised to be 5% faster
          587  +
          588  +Wed May 02 2007 Aleksey
          589  +	* === Version 0.8.8 ===
          590  +
          591  +Sun Apr 22 2007 Aleksey
          592  +	* added options --accept and --crc-accept
          593  +	* added --verbose option
          594  +	* added --maxdepth option
          595  +	* added check before verifying a crc file that it isn't a binary file
          596  +
          597  +Mon Apr 16 2007 Aleksey
          598  +	* === Version 0.8.7 ===
          599  +	* Tiger hash sum optimised for IA32
          600  +
          601  +Tue Apr 10 2007 Aleksey
          602  +	* Bugfix: --update of sfv files worked incorrectly under windows
          603  +
          604  +Mon Apr 09 2007 Aleksey
          605  +	* implemented Tiger hash function
          606  +
          607  +Sun Apr 01 2007 Aleksey
          608  +	* added check before updating a crc file that it isn't a binary file
          609  +
          610  +Mon Mar 26 2007 Aleksey
          611  +	* === Version 0.8.6 ===
          612  +	* Ctrl+C now prints a message and partitial statistics
          613  +
          614  +Sat Mar 24 2007 Aleksey
          615  +	* default format changed to SFV
          616  +
          617  +Mon Mar 19 2007 Aleksey
          618  +	* updating of crc files supported
          619  +
          620  +Wed Jan 31 2007 Aleksey
          621  +	* === Version 0.8.5 ===
          622  +	* supported many short options as one argument, e.g. '-MCEr'
          623  +	* option -S (--sha1) changed to -H
          624  +	* Bugfix: program crashed under BSD while printing SFV file header
          625  +
          626  +Sun Nov 05 2006 Aleksey
          627  +	* === Version 0.8.4 ===
          628  +	* Bugfix: errors/miss stats calculation corrected
          629  +
          630  +Sun Oct 29 2006 Aleksey
          631  +	* supported "-c -" option to check hash sums from stdin
          632  +	* added stdout flushing after each processed file
          633  +	* the program returns exit code 0 on success and 1 if an error occurred
          634  +
          635  +Fri Sep 08 2006 Aleksey
          636  +	* corrected parsing of md5-like files with star-prepended filenames
          637  +
          638  +Wed Apr 19 2006 Aleksey
          639  +	* checking of md5/sha1 files in *BSD format supported
          640  +	* improved I/O errors handling
          641  +
          642  +Mon Apr 10 2006 Aleksey
          643  +	* === Version 0.8.3 ===
          644  +	* cheking of files in standard md5sum/sha1sum format supported
          645  +	* default output format for md5/sha1/ed2k sums changed
          646  +	* man page rewrited
          647  +
          648  +Thu Mar 30 2006 Aleksey
          649  +	* === Version 0.8.2 ===
          650  +	* GCC 2.96 supported
          651  +
          652  +Thu Feb 23 2006 Aleksey
          653  +	* Bugfix: files with .SFV extension (in uppercase) were skiped while recursive checking
          654  +
          655  +Wed Jan 25 2006 Aleksey
          656  +	* === Version 0.8.1 ===
          657  +	* option --check now works with --recursive
          658  +	* Bugfix: corrected output format when checking files
          659  +	* Bugfix: files wasn't opened as binary on Windows when checking sums
          660  +
          661  +Mon Jan 23 2006 Aleksey
          662  +	* === Version 0.8 ===
          663  +	* documentation now distributed with windows version
          664  +	* some *.bat files added to windows version
          665  +
          666  +Sun Jan 22 2006 Aleksey
          667  +	* --check option added, to check hash sums files
          668  +	* --ansi option added (for Windows version only)
          669  +	* program name is parsed now to specify default sums to compute
          670  +
          671  +Sat Jan 14 2006 Aleksey
          672  +	* Bugfix: console windows version now uses OEM (DOS) character set for output
          673  +	
          674  +	* === Version 0.7 ===
          675  +	* some fixes in sfv format output
          676  +
          677  +Fri Sep 16 2005 Aleksey
          678  +	* --recursive option added
          679  +	* --ed2k-link option added
          680  +
          681  +Fri Sep 02 2005 Aleksey
          682  +	* === Version 0.6 ===
          683  +
          684  +Sun Aug 28 2005 Aleksey
          685  +	* Bugfix: files wasn't opened as binary on win32
          686  +	* --sfv format now implies uppercase hashes
          687  +
          688  +Wed Aug 24 2005 Aleksey
          689  +	* added .spec file and Makefile 'rpm' target
          690  +
          691  +Sun Aug 14 2005 Aleksey
          692  +	* === Version 0.5 ===
          693  +	* the first public version
          694  +	* win32 platform supported
          695  +
          696  +Mon Aug 08 2005 Aleksey
          697  +	* Bugfix: fixed calculation of md5/ed2k hashes for AMD64
          698  +
          699  +Fri Aug 05 2005 Aleksey
          700  +	* === Version 0.06 ===
          701  +	* initial linux version supporting crc32, md5, ed2k and sha1

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/INSTALL.md version [2750f9850a].

            1  +
            2  +Installation
            3  +============
            4  +
            5  +Build Prerequisites
            6  +-------------------
            7  +  - GCC or Intel Compiler for Linux / macOS / Unix.
            8  +  - MinGW or MS VC++ for Windows.
            9  +  - (optionally) gettext library for internationalization
           10  +  - (optionally) OpenSSL for optimized algorithms
           11  +
           12  +Build and install
           13  +-----------------
           14  +To compile and install the program use command
           15  +```sh
           16  +./configure && make && make install
           17  +```
           18  +
           19  +The compiled program and library can be tested by command `make test test-lib`
           20  +
           21  +To compile using MS VC++, take the project file from /win32/vc-2010/ directory.
           22  +
           23  +Enabling features
           24  +-----------------
           25  +RHash can use optimized algorithms of MD5, SHA1, SHA2 from the OpenSSL library.
           26  +To link OpenSSL at run-time (preffered way), configure RHash as
           27  +```sh
           28  +./configure --enable-openssl-runtime
           29  +```
           30  +To link it at load-time, use options
           31  +```sh
           32  +./configure --enable-openssl --disable-openssl-runtime
           33  +```
           34  +
           35  +Internationalization support can be compiled and installed by commands
           36  +```sh
           37  +./configure --enable-gettext
           38  +make install install-gmo
           39  +```
           40  +
           41  +Run `./configure --help` for a full list of configuration options.
           42  +
           43  +Building an OS native package
           44  +-----------------------------
           45  +When building a package for an OS Repository, one should correctly specify system directories, e.g.:
           46  +```sh
           47  +./configure --sysconfdir=/etc --exec-prefix=/usr
           48  +```
           49  +
           50  +Example of installing RHash with shared and static LibRHash library:
           51  +```sh
           52  +./configure --enable-lib-static
           53  +make install install-lib-so-link
           54  +```

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/Makefile version [303f536700].

            1  +
            2  +include config.mak
            3  +
            4  +HEADERS = calc_sums.h hash_print.h common_func.h hash_update.h file.h file_mask.h file_set.h find_file.h hash_check.h output.h parse_cmdline.h rhash_main.h win_utils.h platform.h version.h
            5  +SOURCES = calc_sums.c hash_print.c common_func.c hash_update.c file.c file_mask.c file_set.c find_file.c hash_check.c output.c parse_cmdline.c rhash_main.c win_utils.c
            6  +OBJECTS = calc_sums.o hash_print.o common_func.o hash_update.o file.o file_mask.o file_set.o find_file.o hash_check.o output.o parse_cmdline.o rhash_main.o win_utils.o
            7  +WIN_DIST_FILES = dist/MD5.bat dist/magnet.bat dist/rhashrc.sample
            8  +OTHER_FILES = configure Makefile ChangeLog INSTALL.md COPYING README \
            9  +  dist/rhash.spec.in dist/rhash.1 dist/rhash.1.win.sed \
           10  +  tests/test_rhash.sh tests/test1K.data win32/vc-2010/rhash.vcxproj
           11  +LIBRHASH_FILES  = librhash/algorithms.c librhash/algorithms.h \
           12  +  librhash/byte_order.c librhash/byte_order.h librhash/plug_openssl.c librhash/plug_openssl.h \
           13  +  librhash/rhash.c librhash/rhash.h librhash/rhash_torrent.c librhash/rhash_torrent.h \
           14  +  librhash/rhash_timing.c librhash/rhash_timing.h \
           15  +  librhash/aich.c librhash/aich.h librhash/crc32.c librhash/crc32.h \
           16  +  librhash/ed2k.c librhash/ed2k.h librhash/edonr.c librhash/edonr.h \
           17  +  librhash/gost.c librhash/gost.h librhash/has160.c librhash/has160.h \
           18  +  librhash/hex.c librhash/hex.h librhash/md4.c librhash/md4.h \
           19  +  librhash/md5.c librhash/md5.h librhash/ripemd-160.c librhash/ripemd-160.h \
           20  +  librhash/sha1.c librhash/sha1.h librhash/sha3.c librhash/sha3.h \
           21  +  librhash/sha256.c librhash/sha256.h librhash/sha512.c librhash/sha512.h \
           22  +  librhash/snefru.c librhash/snefru.h librhash/tiger.c librhash/tiger.h \
           23  +  librhash/tiger_sbox.c librhash/tth.c librhash/tth.h librhash/whirlpool.c \
           24  +  librhash/whirlpool.h librhash/whirlpool_sbox.c librhash/test_hashes.c \
           25  +  librhash/test_hashes.h librhash/torrent.h librhash/torrent.c librhash/ustd.h \
           26  +  librhash/util.h librhash/Makefile
           27  +I18N_FILES  = po/ca.po po/de.po po/en_AU.po po/es.po po/fr.po po/gl.po po/it.po po/ro.po po/ru.po
           28  +ALL_FILES   = $(SOURCES) $(HEADERS) $(LIBRHASH_FILES) $(OTHER_FILES) $(WIN_DIST_FILES) $(I18N_FILES)
           29  +SPECFILE    = dist/rhash.spec
           30  +LIBRHASH_PC = dist/librhash.pc
           31  +RHASH_NAME     = rhash
           32  +RHASH_BINARY   = rhash$(EXEC_EXT)
           33  +CONFDIR_MACRO  = -DSYSCONFDIR=\"$(SYSCONFDIR)\"
           34  +RPMTOP  = rpms
           35  +RPMDIRS = SOURCES SPECS BUILD SRPMS RPMS
           36  +INSTALL_PROGRAM = $(INSTALL) -m 755
           37  +INSTALL_DATA    = $(INSTALL) -m 644
           38  +
           39  +all: $(BUILD_TARGETS)
           40  +install: build-install-binary install-data install-symlinks $(EXTRA_INSTALL)
           41  +build-static: $(RHASH_STATIC)
           42  +build-shared: $(RHASH_SHARED)
           43  +lib-shared: $(LIBRHASH_SHARED)
           44  +lib-static: $(LIBRHASH_STATIC)
           45  +install-data: install-man install-conf
           46  +uninstall: uninstall-binary uninstall-data uninstall-symlinks uninstall-lib uninstall-gmo uninstall-pkg-config
           47  +
           48  +config.mak:
           49  +	echo "Run the ./configure script first" && false
           50  +
           51  +# creating archives
           52  +WIN_SUFFIX     = win32
           53  +PACKAGE_NAME   = $(RHASH_NAME)-$(VERSION)
           54  +ARCHIVE_BZIP   = $(PACKAGE_NAME)-src.tar.bz2
           55  +ARCHIVE_GZIP   = $(PACKAGE_NAME)-src.tar.gz
           56  +ARCHIVE_FULL   = $(PACKAGE_NAME)-full-src.tar.gz
           57  +ARCHIVE_DEB_GZ = $(RHASH_NAME)_$(VERSION).orig.tar.gz
           58  +ARCHIVE_7Z     = $(PACKAGE_NAME)-src.tar.7z
           59  +ARCHIVE_ZIP    = $(PACKAGE_NAME)-$(WIN_SUFFIX).zip
           60  +WIN_ZIP_DIR    = RHash-$(VERSION)-$(WIN_SUFFIX)
           61  +dist: gzip gzip-bindings
           62  +dist-full: gzip-full
           63  +win-dist: zip
           64  +zip: $(ARCHIVE_ZIP)
           65  +dgz: check $(ARCHIVE_DEB_GZ)
           66  +
           67  +build-install-binary: $(BUILD_TARGETS)
           68  +	+$(MAKE) install-binary
           69  +
           70  +mkdir-bin:
           71  +	$(INSTALL) -d $(BINDIR)
           72  +
           73  +# install binary without (re-)compilation
           74  +install-binary: mkdir-bin
           75  +	$(INSTALL_PROGRAM) $(RHASH_BINARY) $(BINDIR)/$(RHASH_BINARY)
           76  +
           77  +install-man:
           78  +	$(INSTALL) -d $(MANDIR)/man1
           79  +	$(INSTALL_DATA) dist/rhash.1 $(MANDIR)/man1/rhash.1
           80  +
           81  +install-conf:
           82  +	$(INSTALL) -d $(SYSCONFDIR)
           83  +	tr -d \\r < dist/rhashrc.sample > rc.tmp && $(INSTALL_DATA) rc.tmp $(SYSCONFDIR)/rhashrc
           84  +	rm -f rc.tmp
           85  +
           86  +# dependencies should be properly set, otherwise 'make -j<n>' can fail
           87  +install-symlinks: mkdir-bin install-man install-binary
           88  +	cd $(BINDIR) && for f in $(SYMLINKS); do ln -fs $(RHASH_BINARY) $$f$(EXEC_EXT); done
           89  +	cd $(MANDIR)/man1 && for f in $(SYMLINKS); do ln -fs rhash.1* $$f.1; done
           90  +
           91  +install-pkg-config:
           92  +	$(INSTALL) -d $(PKGCONFIGDIR)
           93  +	$(INSTALL_DATA) $(LIBRHASH_PC) $(PKGCONFIGDIR)/
           94  +
           95  +uninstall-binary:
           96  +	rm -f $(BINDIR)/$(RHASH_BINARY)
           97  +
           98  +uninstall-data:
           99  +	rm -f $(MANDIR)/man1/rhash.1
          100  +
          101  +uninstall-symlinks:
          102  +	for f in $(SYMLINKS); do rm -f $(BINDIR)/$$f$(EXEC_EXT) $(MANDIR)/man1/$$f.1; done
          103  +
          104  +uninstall-pkg-config:
          105  +	rm -f $(PKGCONFIGDIR)/librhash.pc
          106  +
          107  +uninstall-lib:
          108  +	+cd librhash && $(MAKE) uninstall-lib
          109  +
          110  +install-lib-static: $(LIBRHASH_STATIC)
          111  +	+cd librhash && $(MAKE) install-lib-static
          112  +
          113  +install-lib-shared: $(LIBRHASH_SHARED)
          114  +	+cd librhash && $(MAKE) install-lib-shared
          115  +
          116  +install-lib-so-link:
          117  +	+cd librhash && $(MAKE) install-so-link
          118  +
          119  +$(LIBRHASH_SHARED): $(LIBRHASH_FILES)
          120  +	+cd librhash && $(MAKE) lib-shared
          121  +
          122  +$(LIBRHASH_STATIC): $(LIBRHASH_FILES)
          123  +	+cd librhash && $(MAKE) lib-static
          124  +
          125  +test-lib: test-lib-$(BUILD_TYPE)
          126  +test-lib-static: $(LIBRHASH_STATIC)
          127  +	+cd librhash && $(MAKE) test-static
          128  +
          129  +test-lib-shared: $(LIBRHASH_SHARED)
          130  +	+cd librhash && $(MAKE) test-shared
          131  +
          132  +test-libs: $(LIBRHASH_STATIC) $(LIBRHASH_SHARED)
          133  +	+cd librhash && $(MAKE) test-static test-shared
          134  +
          135  +test: test-$(BUILD_TYPE)
          136  +test-static: $(RHASH_STATIC)
          137  +	chmod +x tests/test_rhash.sh
          138  +	tests/test_rhash.sh ./$(RHASH_STATIC)
          139  +
          140  +test-shared: $(RHASH_SHARED)
          141  +	chmod +x tests/test_rhash.sh
          142  +	tests/test_rhash.sh --shared ./$(RHASH_SHARED)
          143  +
          144  +print-info: lib-$(BUILD_TYPE)
          145  +	+cd librhash && $(MAKE) print-info
          146  +
          147  +# check that source tree is consistent
          148  +check:
          149  +	grep -q '\* === Version $(VERSION) ===' ChangeLog
          150  +	grep -q '^#define VERSION "$(VERSION)"' version.h
          151  +	test ! -f bindings/version.properties || grep -q '^version=$(VERSION)$$' bindings/version.properties
          152  +
          153  +$(RHASH_STATIC): $(OBJECTS) $(LIBRHASH_STATIC)
          154  +	$(CC) $(OBJECTS) $(LIBRHASH_STATIC) $(BIN_STATIC_LDFLAGS) -o $@
          155  +
          156  +$(RHASH_SHARED): $(OBJECTS) $(LIBRHASH_SHARED)
          157  +	$(CC) $(OBJECTS) $(LIBRHASH_SHARED) $(LDFLAGS) -o $@
          158  +
          159  +# NOTE: dependences were generated by 'gcc -Ilibrhash -MM *.c'
          160  +# we are using plain old makefile style to support BSD make
          161  +calc_sums.o: calc_sums.c platform.h calc_sums.h common_func.h \
          162  + hash_check.h file.h hash_print.h output.h parse_cmdline.h rhash_main.h \
          163  + win_utils.h librhash/rhash.h librhash/rhash_torrent.h
          164  +	$(CC) -c $(CFLAGS) $< -o $@
          165  +
          166  +common_func.o: common_func.c common_func.h parse_cmdline.h version.h \
          167  + win_utils.h
          168  +	$(CC) -c $(CFLAGS) $< -o $@
          169  +
          170  +file.o: file.c file.h common_func.h win_utils.h
          171  +	$(CC) -c $(CFLAGS) $< -o $@
          172  +
          173  +file_mask.o: file_mask.c file_mask.h common_func.h
          174  +	$(CC) -c $(CFLAGS) $< -o $@
          175  +
          176  +file_set.o: file_set.c file_set.h calc_sums.h common_func.h hash_check.h \
          177  + hash_print.h output.h parse_cmdline.h rhash_main.h librhash/rhash.h
          178  +	$(CC) -c $(CFLAGS) $< -o $@
          179  +
          180  +find_file.o: find_file.c platform.h find_file.h common_func.h file.h \
          181  + output.h win_utils.h
          182  +	$(CC) -c $(CFLAGS) $< -o $@
          183  +
          184  +hash_check.o: hash_check.c hash_check.h hash_print.h common_func.h \
          185  + output.h parse_cmdline.h librhash/rhash.h
          186  +	$(CC) -c $(CFLAGS) $< -o $@
          187  +
          188  +hash_print.o: hash_print.c hash_print.h calc_sums.h common_func.h \
          189  + hash_check.h file.h parse_cmdline.h win_utils.h librhash/rhash.h
          190  +	$(CC) -c $(CFLAGS) $< -o $@
          191  +
          192  +hash_update.o: hash_update.c common_func.h calc_sums.h hash_check.h \
          193  + file.h file_set.h file_mask.h hash_print.h hash_update.h output.h \
          194  + parse_cmdline.h rhash_main.h win_utils.h
          195  +	$(CC) -c $(CFLAGS) $< -o $@
          196  +
          197  +output.o: output.c platform.h output.h calc_sums.h common_func.h \
          198  + hash_check.h parse_cmdline.h rhash_main.h win_utils.h librhash/rhash.h
          199  +	$(CC) -c $(CFLAGS) $< -o $@
          200  +
          201  +parse_cmdline.o: parse_cmdline.c parse_cmdline.h common_func.h \
          202  + file_mask.h find_file.h file.h hash_print.h output.h rhash_main.h \
          203  + win_utils.h librhash/rhash.h
          204  +	$(CC) -c $(CFLAGS) $< -o $@
          205  +
          206  +rhash_main.o: rhash_main.c rhash_main.h calc_sums.h common_func.h \
          207  + hash_check.h file_mask.h find_file.h file.h hash_print.h hash_update.h \
          208  + parse_cmdline.h output.h win_utils.h librhash/rhash.h
          209  +	$(CC) -c $(CFLAGS) $< -o $@
          210  +
          211  +win_utils.o: win_utils.c win_utils.h common_func.h file.h parse_cmdline.h \
          212  + rhash_main.h
          213  +	$(CC) -c $(CFLAGS) $< -o $@
          214  +
          215  +dist/rhash.1.win.html: dist/rhash.1 dist/rhash.1.win.sed
          216  +	sed -f dist/rhash.1.win.sed dist/rhash.1 | rman -fHTML -roff | \
          217  +	sed -e '/<BODY/s/\(bgcolor=\)"[^"]*"/\1"white"/i' > dist/rhash.1.win.html
          218  +#	verify the result
          219  +	grep -q "utf8" dist/rhash.1.win.html
          220  +	grep -q "APPDATA" dist/rhash.1.win.html
          221  +
          222  +dist/rhash.1.html: dist/rhash.1
          223  +	-which rman 2>/dev/null && (rman -fHTML -roff dist/rhash.1 | sed -e '/<BODY/s/\(bgcolor=\)"[^"]*"/\1"white"/i' > $@)
          224  +
          225  +dist/rhash.1.txt: dist/rhash.1
          226  +	-which groff &>/dev/null && (groff -t -e -mandoc -Tascii dist/rhash.1 | sed -e 's/.\[[0-9]*m//g' > $@)
          227  +
          228  +cpp-doc:
          229  +	cppdoc_cmd -title=RHash -company=Akademgorodok -classdir=classdoc -module="cppdoc-standard" -overwrite -extensions="c,h" -languages="c=cpp,h=cpp" -generate-deprecations-list=false $(SOURCES) $(HEADERS) ./Documentation/CppDoc/index.html
          230  +
          231  +permissions:
          232  +	find . dist librhash po win32 win32/vc-2010 -maxdepth 1 -type f -exec chmod -x '{}' \;
          233  +	chmod +x configure tests/test_rhash.sh
          234  +
          235  +copy-dist: $(ALL_FILES) permissions
          236  +	rm -rf $(PACKAGE_NAME)
          237  +	mkdir $(PACKAGE_NAME)
          238  +	cp -rl --parents $(ALL_FILES) $(PACKAGE_NAME)/
          239  +
          240  +gzip: check
          241  +	+$(MAKE) copy-dist
          242  +	tar czf $(ARCHIVE_GZIP) --owner=root --group=root $(PACKAGE_NAME)/
          243  +	rm -rf $(PACKAGE_NAME)
          244  +
          245  +gzip-bindings:
          246  +	+cd bindings && $(MAKE) gzip ARCHIVE_GZIP=../rhash-bindings-$(VERSION)-src.tar.gz
          247  +
          248  +gzip-full: check clean-bindings
          249  +	+$(MAKE) copy-dist
          250  +	+cd bindings && $(MAKE) copy-dist COPYDIR=../$(PACKAGE_NAME)/bindings
          251  +	tar czf $(ARCHIVE_FULL) --owner=root:0 --group=root:0 $(PACKAGE_NAME)/
          252  +	rm -rf $(PACKAGE_NAME)
          253  +
          254  +bzip: check
          255  +	+$(MAKE) copy-dist
          256  +	tar cjf $(ARCHIVE_BZIP) --owner=root:0 --group=root:0 $(PACKAGE_NAME)/
          257  +	rm -rf $(PACKAGE_NAME)
          258  +
          259  +7z: check
          260  +	+$(MAKE) copy-dist
          261  +	tar cf - --owner=root:0 --group=root:0 $(PACKAGE_NAME)/ | 7zr a -si $(ARCHIVE_7Z)
          262  +	rm -rf $(PACKAGE_NAME)
          263  +
          264  +$(ARCHIVE_ZIP): $(WIN_DIST_FILES) dist/rhash.1.win.html
          265  +	test -s dist/rhash.1.win.html && test -x $(RHASH_BINARY)
          266  +	-rm -rf $(WIN_ZIP_DIR)
          267  +	mkdir $(WIN_ZIP_DIR)
          268  +	cp $(RHASH_BINARY) ChangeLog $(WIN_DIST_FILES) $(WIN_ZIP_DIR)/
          269  +	cp dist/rhash.1.win.html $(WIN_ZIP_DIR)/rhash-doc.html
          270  +	zip -9r $(ARCHIVE_ZIP) $(WIN_ZIP_DIR)
          271  +	rm -rf $(WIN_ZIP_DIR)
          272  +
          273  +$(ARCHIVE_DEB_GZ) : $(ALL_FILES)
          274  +	+$(MAKE) $(ARCHIVE_GZIP)
          275  +	mv -f $(ARCHIVE_GZIP) $(ARCHIVE_DEB_GZ)
          276  +
          277  +# rpm packaging
          278  +$(SPECFILE): $(SPECFILE).in config.mak
          279  +	sed -e 's/@VERSION@/$(VERSION)/' $(SPECFILE).in > $(SPECFILE)
          280  +
          281  +rpm: gzip
          282  +	-for i in $(RPMDIRS); do mkdir -p $(RPMTOP)/$$i; done
          283  +	cp -f $(ARCHIVE_GZIP) $(RPMTOP)/SOURCES
          284  +	rpmbuild -ba --clean --define "_topdir `pwd`/$(RPMTOP)" $(SPECFILE)
          285  +	mv -f `find $(RPMTOP) -name "*rhash*-$(VERSION)*.rpm"` .
          286  +	rm -rf $(RPMTOP)
          287  +
          288  +clean-bindings:
          289  +	+cd bindings && $(MAKE) clean
          290  +
          291  +clean-local:
          292  +	rm -f *.o $(RHASH_SHARED) $(RHASH_STATIC)
          293  +	rm -f po/*.gmo po/*.po~
          294  +
          295  +distclean: clean-local
          296  +	rm -f config.log config.mak $(SPECFILE) $(LIBRHASH_PC)
          297  +	+cd librhash && $(MAKE) distclean
          298  +
          299  +clean: clean-local
          300  +	+cd librhash && $(MAKE) clean
          301  +
          302  +update-po:
          303  +	xgettext *.c -k_ -cTRANSLATORS -o po/rhash.pot \
          304  +		--msgid-bugs-address='Aleksey <rhash.admin@gmail.com>' --package-name='RHash'
          305  +	for f in $(I18N_FILES); do \
          306  +		msgmerge -U $$f po/rhash.pot; \
          307  +	done
          308  +
          309  +compile-gmo:
          310  +	for f in $(I18N_FILES); do \
          311  +		g=`basename $$f .po`; \
          312  +		msgfmt $$f -o po/$$g.gmo; \
          313  +	done
          314  +
          315  +install-gmo: compile-gmo
          316  +	for f in $(I18N_FILES); do \
          317  +		l=`basename $$f .po`; \
          318  +		$(INSTALL) -d $(LOCALEDIR)/$$l/LC_MESSAGES; \
          319  +		$(INSTALL_DATA) po/$$l.gmo $(LOCALEDIR)/$$l/LC_MESSAGES/rhash.mo; \
          320  +	done
          321  +
          322  +uninstall-gmo:
          323  +	for f in $(I18N_FILES); do \
          324  +		rm -f $(LOCALEDIR)/`basename $$f .po`/LC_MESSAGES/rhash.mo; \
          325  +	done
          326  +
          327  +.PHONY: all build-shared build-static lib-shared lib-static clean clean-bindings distclean clean-local \
          328  +	test test-shared test-static test-lib test-libs test-lib-shared test-lib-static \
          329  +	install build-install-binary install-binary install-lib-shared install-lib-static \
          330  +	install-lib-so-link install-conf install-data install-gmo install-man \
          331  +	install-symlinks install-pkg-config uninstall-gmo uninstall-pkg-config \
          332  +	uninstall uninstall-binary uninstall-data uninstall-lib uninstall-symlinks \
          333  +	print-info check copy-dist update-po compile-gmo cpp-doc mkdir-bin permissions \
          334  +	bzip dgz dist dist-full gzip gzip-bindings gzip-full rpm win-dist zip

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/README version [d6b9dd8c76].

            1  +                           === RHash program ===
            2  +
            3  +RHash is a console utility for calculation  and verification of magnet links
            4  +and a wide range of hash sums like  CRC32,  MD4, MD5,  SHA1, SHA256, SHA512,
            5  +SHA3,   AICH,  ED2K,  Tiger,  DC++ TTH,  BitTorrent BTIH,   GOST R 34.11-94,
            6  +RIPEMD-160, HAS-160, EDON-R, Whirlpool and Snefru.
            7  +
            8  +Hash sums are used to  ensure and verify integrity  of large volumes of data
            9  +for a long-term storing or transferring.
           10  +
           11  +Program features:
           12  + * Output in a predefined (SFV, BSD-like) or a user-defined format.
           13  + * Calculation of Magnet links.
           14  + * Ability to process directories recursively.
           15  + * Updating hash files (adding hash sums of files missing in the hash file).
           16  + * Calculates several hash sums in one pass.
           17  + * Portability: the program works the same on Linux, Unix, macOS or Windows.
           18  +
           19  +
           20  +                        === The LibRHash library ===
           21  +
           22  +LibRHash is a professional,  portable,  thread-safe  C library for computing
           23  +a wide variety of hash sums, such as  CRC32, MD4, MD5, SHA1, SHA256, SHA512,
           24  +SHA3,   AICH,  ED2K,  Tiger,  DC++ TTH,  BitTorrent BTIH,   GOST R 34.11-94,
           25  +RIPEMD-160, HAS-160, EDON-R, Whirlpool and Snefru.
           26  +Hash sums are used  to ensure and verify integrity of  large volumes of data
           27  +for a long-term storing or transferring.
           28  +
           29  +Features:
           30  + * Small and easy to learn interface.
           31  + * Hi-level and Low-level API.
           32  + * Allows calculating of several hash functions simultaneously.
           33  + * Portability: the library works on Linux, *BSD and Windows.
           34  +
           35  +
           36  +                               === Links ===
           37  +
           38  + * Project Home Page: http://rhash.sourceforge.net/
           39  + * Official Releases: http://sf.net/projects/rhash/files/rhash/
           40  +
           41  + * RHash hash functions descriptions http://rhash.anz.ru/hashes.php
           42  + * The table of the hash functions supported by RHash
           43  +   https://sf.net/p/rhash/wiki/HashFunctions/
           44  + * ECRYPT: The Hash Function Zoo
           45  +   http://ehash.iaik.tugraz.at/wiki/The_Hash_Function_Zoo
           46  +
           47  +
           48  +                     === Getting latest source code ===
           49  +
           50  +The latest source code can be obtained from Git repository by command:
           51  +
           52  +  git clone git://github.com/rhash/RHash.git
           53  +
           54  +
           55  +                       === Notes on RHash License ===
           56  +
           57  +The RHash program and LibRHash library are distributed under  RHash License,
           58  +see the COPYING file for details.  In particular,  the program,  the library
           59  +and  source code  can be  used  free of charge  under  the  MIT,  BSD,  GPL,
           60  +commercial or freeware license without additional restrictions.  In the case
           61  +the OSI-approved license is required the  MIT license should be used.

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/bindings/COPYING version [f18ee9648a].

            1  +
            2  +                                RHash License
            3  +
            4  +Copyright (c) 2011-2014 Aleksey Kravchenko <rhash.admin@gmail.com>
            5  +Copyright (c) 2011-2012 Sergey Basalaev
            6  +
            7  +Permission is hereby granted, free of charge,  to any person obtaining a copy
            8  +of this software and associated documentation files (the "Software"), to deal
            9  +in the Software without restriction,  including without limitation the rights
           10  +to  use,  copy,  modify,  merge, publish, distribute, sublicense, and/or sell
           11  +copies  of  the Software,  and  to permit  persons  to whom  the Software  is
           12  +furnished to do so.
           13  +
           14  +The Software  is distributed in the hope that it will be useful,  but WITHOUT
           15  +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
           16  +FOR A PARTICULAR PURPOSE.  Use  this  program  at  your  own  risk!

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/bindings/ChangeLog version [8f7f3ffd4b].

            1  +Fri Aug  1 2014 Aleksey
            2  +	* python 3 support
            3  +	* update SHA3 test vectors to follow the changes of the spec
            4  +
            5  +Sun Jan 19 2014 Aleksey
            6  +	* renamed perl module to the Crypt::Rhash
            7  +
            8  +Tue Sep 17 2013 Aleksey
            9  +	* === Version 1.3.0 ===
           10  +
           11  +Tue Dec 25 2012 Aleksey
           12  +	* === Version 1.2.10 ===
           13  +
           14  +Sun May 13 2012 Aleksey
           15  +	* BugFix: python crashed on ia64
           16  +
           17  +Tue Apr 17 2012 Aleksey
           18  +	* PHP bindings for librhash
           19  +
           20  +Sat Apr 14 2012 Aleksey
           21  +	* === Version 1.2.9 ===
           22  +
           23  +Sun Nov 06 2011 Sergey Basalaev
           24  +	* .NET/Mono bindings to librhash
           25  +
           26  +Wed Sep 14 2011 Aleksey
           27  +	* === Version 1.2.8 ===
           28  +
           29  +Wed Sep 14 2011 Aleksey
           30  +	* Perl bindings
           31  +
           32  +Sat Jul  9 2011 Sergey Basalaev
           33  +	* Ruby bindings
           34  +
           35  +Thu Jun 16 2011 Sergey Basalaev
           36  +	* Python bindings
           37  +
           38  +Sun Jun 12 2011 Sergey Basalaev
           39  +	* LibRHash Java bindings

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/bindings/Makefile version [ebb07f85e2].

            1  +VERSION := $(shell sed -ne 's/^version=\(.*\)/\1/p' version.properties)
            2  +BINDINGS = java mono perl python ruby php
            3  +FILES = Makefile version.properties ChangeLog COPYING
            4  +DESTDIR =
            5  +PREFIX = /usr/local
            6  +RUBY ?= ruby
            7  +PYTHON ?= python
            8  +PERL ?= perl
            9  +CP = cp -l --parents
           10  +PERL_OPTIMIZE = -O2 -g -Wall
           11  +ARCHIVE_GZIP = rhash-bindings-$(VERSION)-src.tar.gz
           12  +COPYDIR = rhash-bindings-$(VERSION)
           13  +
           14  +all: configure build test
           15  +clean: distclean
           16  +
           17  +configure: $(patsubst %, configure-%, $(filter perl ruby php, $(BINDINGS)))
           18  +build: $(patsubst %, build-%, $(BINDINGS))
           19  +test: $(patsubst %, test-%, $(BINDINGS))
           20  +install: $(patsubst %, install-%, $(filter perl ruby php, $(BINDINGS)))
           21  +
           22  +configure-perl: perl/Makefile
           23  +configure-ruby: ruby/Makefile
           24  +configure-php: php/Makefile
           25  +
           26  +perl/Makefile: perl/Makefile.PL
           27  +	cd perl && USE_SYSTEM_LIBRHASH=1 $(PERL) Makefile.PL INSTALLDIRS=vendor
           28  +
           29  +php/Makefile: php/config.m4
           30  +	cd php && phpize && ./configure --with-rhash
           31  +
           32  +ruby/Makefile: ruby/extconf.rb
           33  +	$(RUBY) -C ruby extconf.rb
           34  +
           35  +build-java:
           36  +	+$(MAKE) -C java build-binary
           37  +
           38  +build-perl: configure-perl
           39  +	+$(MAKE) -C perl OPTIMIZE="$(PERL_OPTIMIZE)"
           40  +
           41  +build-php: configure-php
           42  +	+$(MAKE) -C php
           43  +
           44  +build-python:
           45  +# not required
           46  +
           47  +build-ruby: configure-ruby
           48  +	+$(MAKE) -C ruby
           49  +
           50  +build-mono:
           51  +	+$(MAKE) -C mono
           52  +
           53  +test-java:
           54  +	+$(MAKE) -C java test
           55  +
           56  +test-perl:
           57  +	+$(MAKE) -C perl test
           58  +
           59  +test-php:
           60  +	+$(MAKE) -C php test TEST_PHP_ARGS=-q
           61  +
           62  +test-ruby:
           63  +	$(RUBY) -C ruby -I. test_rhash.rb
           64  +
           65  +test-mono:
           66  +	+$(MAKE) -C mono test
           67  +
           68  +test-python:
           69  +	$(PYTHON) python/test_rhash.py
           70  +
           71  +install-ruby:
           72  +# clear MAKEFLAGS to overcome ruby1.8 mkmf concurrency bug
           73  +	+MAKEFLAGS= $(MAKE) -C ruby install DESTDIR=$(DESTDIR) sitedir=$(DESTDIR)/usr/lib/ruby
           74  +
           75  +install-perl:
           76  +	+$(MAKE) -C perl install DESTDIR=$(DESTDIR)
           77  +
           78  +install-php:
           79  +	+$(MAKE) -C php install INSTALL_ROOT=$(DESTDIR)
           80  +
           81  +copy-dist:
           82  +	mkdir -p $(COPYDIR)
           83  +	find java ruby python -type f -regex '.*\(\.\([hc]\|java\|py\|rb\|txt\)\|Makefile\)' -exec $(CP) '{}' $(COPYDIR)/ \;
           84  +	find mono -type f -regex '.*\(\.\([hc]\|cs\|xml\|txt\|snk\|sln\|csproj\|config\)\|Makefile\)' -exec $(CP) '{}' "$(COPYDIR)/" \;
           85  +	$(CP) $(shell sed -e 's/\([^ ]*\).*/perl\/\1/' perl/MANIFEST) "$(COPYDIR)/"
           86  +	find php -type f -regex '.*\.\(m4\|c\|h\|phpt\)' -exec $(CP) '{}' "$(COPYDIR)/" \;
           87  +	$(CP) $(FILES) "$(COPYDIR)/"
           88  +
           89  +gzip: distclean
           90  +	rm -rf "$(COPYDIR)" $(ARCHIVE_GZIP)
           91  +	+$(MAKE) copy-dist
           92  +	tar -czf $(ARCHIVE_GZIP) --owner=root:0 --group=root:0 "$(COPYDIR)"
           93  +	rm -rf "$(COPYDIR)"
           94  +
           95  +PERL_PKG_VER = $(shell [ -f perl/Rhash.pm ] && sed -ne "s/^our \+.VERSION *= *'\([0-9\.]*\)';/\1/p;" perl/Rhash.pm)
           96  +PERL_PKG = Crypt-RHash-$(PERL_PKG_VER)
           97  +
           98  +cpan:
           99  +	[ -f ../librhash/rhash.h ]
          100  +	echo "$(PERL_PKG_VER)" | grep -q '^[0-9\.]\+$$'
          101  +	rm -rf $(PERL_PKG)/ $(PERL_PKG).tar.gz
          102  +	mkdir -p $(PERL_PKG)/librhash/
          103  +	grep -q / perl/MANIFEST && mkdir -p `sed -ne '/\//s/\([^\/]*\/\).*/$(PERL_PKG)\/\1/p' perl/MANIFEST | sort -u`
          104  +	sed -e 's/^\([^ ]*\)\( .*\)\?/cp perl\/\1 $(PERL_PKG)\/\1/' perl/MANIFEST > _cpy.sh
          105  +	sh _cpy.sh && rm -f _cpy.sh
          106  +	cp ../librhash/*.[hc] $(PERL_PKG)/librhash/
          107  +	cp perl/MANIFEST $(PERL_PKG)/
          108  +	find $(PERL_PKG)/librhash/ -type f -printf "librhash/%f\n" | sort >> $(PERL_PKG)/MANIFEST
          109  +	tar -czf $(PERL_PKG).tar.gz --owner=root:0 --group=root:0 $(PERL_PKG)/
          110  +	rm -rf $(PERL_PKG)/
          111  +
          112  +distclean:
          113  +	+$(MAKE) -C java distclean
          114  +	+$(MAKE) -C mono clean
          115  +	+[ ! -f ruby/Makefile ] || $(MAKE) -C ruby distclean
          116  +	+[ ! -f perl/Makefile ] || $(MAKE) -C perl distclean
          117  +	[ ! -f php/configure ] || (cd php && phpize --clean)
          118  +	rm -f python/*.pyc

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/bindings/java/.gitignore version [eecb5f4770].

            1  +classes/*
            2  +dist/*
            3  +*.so
            4  +*.class

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/bindings/java/Makefile version [04770b84b5].

            1  +#!/usr/bin/make -f
            2  +
            3  +# This file is a part of Java Bindings for Librhash
            4  +# Copyright (c) 2011-2012, Sergey Basalaev <sbasalaev@gmail.com>
            5  +# Librhash is (c) 2011-2012, Aleksey Kravchenko <rhash.admin@gmail.com>
            6  +# 
            7  +# Permission is hereby granted, free of charge,  to any person obtaining a copy
            8  +# of this software and associated documentation files (the "Software"), to deal
            9  +# in the Software without restriction,  including without limitation the rights
           10  +# to  use,  copy,  modify,  merge, publish, distribute, sublicense, and/or sell
           11  +# copies  of  the Software,  and  to permit  persons  to whom  the Software  is
           12  +# furnished to do so.
           13  +# 
           14  +# This library  is distributed  in the hope that it will be useful, but WITHOUT
           15  +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
           16  +# FOR A PARTICULAR PURPOSE. Use it at your own risk!
           17  +
           18  +
           19  +JAVA = java
           20  +JAVAC = javac
           21  +JAVADOC = javadoc
           22  +JAVAH = javah
           23  +JAR = jar
           24  +JUNIT_CLASSPATH = /usr/share/java/junit4.jar
           25  +
           26  +VERSION = $(shell sed -ne 's/^version=\(.*\)/\1/p' ../version.properties)
           27  +
           28  +JAVASRC_DIR = src
           29  +CSRC_DIR    = native
           30  +DEST_DIR    = dist
           31  +CLASSES_DIR = classes
           32  +JAVADOC_DIR = javadoc
           33  +TEST_DIR    = test
           34  +
           35  +JAVA_FILES := $(shell find $(JAVASRC_DIR) -name '*.java')
           36  +JNI_FILES := $(shell find $(CSRC_DIR) -name '*.c' -o -name '*.h')
           37  +LIB_PREFIX = lib
           38  +LIB_SUFFIX = .so
           39  +JNI_LIBRARY = $(LIB_PREFIX)rhash-jni$(LIB_SUFFIX)
           40  +JARFILE = $(DEST_DIR)/rhash-$(VERSION).jar
           41  +JAVADOC_FILE = $(DEST_DIR)/rhash-$(VERSION)-javadoc.zip
           42  +JAVADOC_API_URL = http://download.oracle.com/javase/6/docs/api/
           43  +
           44  +
           45  +all: build-binary javadoc
           46  +build-binary: jar jar-symlink jni
           47  +jar: $(JARFILE)
           48  +jni: $(DEST_DIR)/$(JNI_LIBRARY)
           49  +zip-javadoc: $(JAVADOC_FILE)
           50  +
           51  +jar-symlink:
           52  +	mkdir -p $(DEST_DIR)
           53  +	ln -fs rhash-$(VERSION).jar $(DEST_DIR)/rhash.jar
           54  +
           55  +$(JARFILE): $(JAVA_FILES)
           56  +	+$(MAKE) compile-classes
           57  +	mkdir -p $(DEST_DIR)
           58  +	$(JAR) cf $(JARFILE) -C $(CLASSES_DIR) org/
           59  +
           60  +compile-classes:
           61  +	mkdir -p $(CLASSES_DIR)
           62  +	$(JAVAC) -d $(CLASSES_DIR) -sourcepath $(JAVASRC_DIR) $(JAVA_FILES)
           63  +
           64  +update-header: compile-classes
           65  +	$(JAVAH) -o $(CSRC_DIR)/bindings.h -classpath $(CLASSES_DIR)  org.sf.rhash.Bindings
           66  +
           67  +$(DEST_DIR)/$(JNI_LIBRARY): $(JNI_FILES)
           68  +	+$(MAKE) -C $(CSRC_DIR)
           69  +	mkdir -p $(DEST_DIR)
           70  +	cp $(CSRC_DIR)/$(JNI_LIBRARY) $(DEST_DIR)
           71  +
           72  +javadoc: clean-javadoc
           73  +	$(JAVADOC) -windowtitle 'RHash' \
           74  +	           -sourcepath $(JAVASRC_DIR) \
           75  +	           -subpackages org \
           76  +	           -d $(JAVADOC_DIR) \
           77  +	           -link $(JAVADOC_API_URL)
           78  +
           79  +$(JAVADOC_FILE): $(JAVA_FILES)
           80  +	+$(MAKE) javadoc
           81  +	jar -cMf $(JAVADOC_FILE) $(JAVADOC_DIR)
           82  +
           83  +$(TEST_DIR)/RHashTest.class: $(JARFILE) $(TEST_DIR)/RHashTest.java
           84  +	$(JAVAC) -classpath $(JARFILE):$(JUNIT_CLASSPATH) $(TEST_DIR)/RHashTest.java
           85  +
           86  +test: $(TEST_DIR)/RHashTest.class jni
           87  +	$(JAVA) -classpath $(TEST_DIR):$(JARFILE):$(JUNIT_CLASSPATH) -Djava.library.path=$(DEST_DIR) junit.textui.TestRunner RHashTest
           88  +
           89  +clean: clean-javadoc clean-jni clean-classes clean-test
           90  +
           91  +clean-javadoc:
           92  +	rm -rf $(JAVADOC_DIR)
           93  +
           94  +clean-classes:
           95  +	rm -rf $(CLASSES_DIR)
           96  +
           97  +clean-jni:
           98  +	+$(MAKE) -C $(CSRC_DIR) clean
           99  +
          100  +clean-test:
          101  +	rm -f $(TEST_DIR)/*.class
          102  +
          103  +distclean: clean
          104  +	rm -rf $(DEST_DIR)
          105  +
          106  +.PHONY: jar jni javadoc test clean clean-javadoc distclean

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/bindings/java/native/Makefile version [f12a971bc9].

            1  +#!/usr/bin/make -f
            2  +
            3  +# This file is a part of Java Bindings for Librhash
            4  +# Copyright (c) 2011-2012, Sergey Basalaev <sbasalaev@gmail.com>
            5  +# Librhash is (c) 2011-2012, Aleksey Kravchenko <rhash.admin@gmail.com>
            6  +# 
            7  +# Permission is hereby granted, free of charge,  to any person obtaining a copy
            8  +# of this software and associated documentation files (the "Software"), to deal
            9  +# in the Software without restriction,  including without limitation the rights
           10  +# to  use,  copy,  modify,  merge, publish, distribute, sublicense, and/or sell
           11  +# copies  of  the Software,  and  to permit  persons  to whom  the Software  is
           12  +# furnished to do so.
           13  +# 
           14  +# This library  is distributed  in the hope that it will be useful, but WITHOUT
           15  +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
           16  +# FOR A PARTICULAR PURPOSE. Use it at your own risk!
           17  +
           18  +
           19  +CC = gcc
           20  +CFLAGS = -g -O2
           21  +LDFLAGS =
           22  +LIBRHASH_INC =
           23  +LIBRHASH_LD  =
           24  +ALLLDFLAGS = $(LDFLAGS) -lrhash $(LIBRHASH_LD)
           25  +ALLCFLAGS = $(CFLAGS) $(LIBRHASH_INC) -fPIC
           26  +
           27  +#Platform dependent
           28  +JNI_CFLAGS = -I/usr/lib/jvm/default-java/include
           29  +LIB_PREFIX = lib
           30  +LIB_SUFFIX = .so
           31  +
           32  +OBJECTS = bindings.o digest.o
           33  +LIBRARY = $(LIB_PREFIX)rhash-jni$(LIB_SUFFIX)
           34  +
           35  +all: $(LIBRARY)
           36  +
           37  +bindings.o: bindings.c bindings.h
           38  +	$(CC) $(ALLCFLAGS) $(JNI_CFLAGS) -c $< -o $@
           39  +
           40  +digest.o: digest.c digest.h
           41  +	$(CC) $(ALLCFLAGS) -c $< -o $@
           42  +
           43  +$(LIBRARY): $(OBJECTS)
           44  +	$(CC) -shared -o $@ $(OBJECTS) $(ALLLDFLAGS)
           45  +
           46  +clean:
           47  +	rm -f *.o $(LIBRARY)
           48  +

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/bindings/java/native/bindings.c version [5d73762e57].

            1  +/*
            2  + * This file is a part of Java Bindings for Librhash
            3  + * Copyright (c) 2011-2012, Sergey Basalaev <sbasalaev@gmail.com>
            4  + * Librhash is (c) 2011-2012, Aleksey Kravchenko <rhash.admin@gmail.com>
            5  + * 
            6  + * Permission is hereby granted, free of charge,  to any person obtaining a copy
            7  + * of this software and associated documentation files (the "Software"), to deal
            8  + * in the Software without restriction,  including without limitation the rights
            9  + * to  use,  copy,  modify,  merge, publish, distribute, sublicense, and/or sell
           10  + * copies  of  the Software,  and  to permit  persons  to whom  the Software  is
           11  + * furnished to do so.
           12  + * 
           13  + * This library  is distributed  in the hope that it will be useful, but WITHOUT
           14  + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
           15  + * FOR A PARTICULAR PURPOSE. Use it at your own risk!
           16  + */
           17  +
           18  +#include <rhash.h>
           19  +#include <stdlib.h>
           20  +
           21  +#ifdef __GNUC__
           22  +#include <stdint.h>
           23  +#define TO_RHASH(a)   ((rhash)(intptr_t)(a))
           24  +#define TO_DIGEST(a)  ((Digest)(intptr_t)(a))
           25  +#define TO_JLONG(a)   ((jlong)(intptr_t)(a))
           26  +#else
           27  +#define TO_RHASH(a)   ((rhash)(a))
           28  +#define TO_DIGEST(a)  ((Digest)(a))
           29  +#define TO_JLONG(a)   ((jlong)(a))
           30  +#endif /* __GNUC__ */
           31  +
           32  +
           33  +#include "bindings.h"
           34  +#include "digest.h"
           35  +
           36  +/*
           37  + * Class:     org_sf_rhash_Bindings
           38  + * Method:    rhash_library_init
           39  + * Signature: ()V
           40  + */
           41  +JNIEXPORT void JNICALL Java_org_sf_rhash_Bindings_rhash_1library_1init
           42  +(JNIEnv *env, jclass clz) {
           43  +	rhash_library_init();
           44  +}
           45  +
           46  +/*
           47  + * Class:     org_sf_rhash_Bindings
           48  + * Method:    rhash_count
           49  + * Signature: ()I
           50  + */
           51  +JNIEXPORT jint JNICALL Java_org_sf_rhash_Bindings_rhash_1count
           52  +(JNIEnv *env, jclass clz) {
           53  +	return rhash_count();
           54  +}
           55  +
           56  +/*
           57  + * Class:     org_sf_rhash_Bindings
           58  + * Method:    rhash_msg
           59  + * Signature: (I[BII)J
           60  + */
           61  +JNIEXPORT jlong JNICALL Java_org_sf_rhash_Bindings_rhash_1msg
           62  +(JNIEnv *env, jclass clz, jint hash_id, jbyteArray buf, jint ofs, jint len) {
           63  +	// reading data
           64  +	void* msg = malloc(len);
           65  +	(*env)->GetByteArrayRegion(env, buf, ofs, len, msg);
           66  +	// creating and populating Digest
           67  +	Digest obj = malloc(sizeof(DigestStruct));
           68  +	obj->hash_len  = rhash_get_digest_size(hash_id);
           69  +	obj->hash_data = calloc(obj->hash_len, sizeof(unsigned char));
           70  +	rhash_msg(hash_id, msg, len, obj->hash_data);
           71  +	//cleaning
           72  +	free(msg);
           73  +	//returning
           74  +	return TO_JLONG(obj);
           75  +}
           76  +
           77  +/*
           78  + * Class:     org_sf_rhash_Bindings
           79  + * Method:    rhash_print_bytes
           80  + * Signature: (JI)[B
           81  + */
           82  +JNIEXPORT jbyteArray JNICALL Java_org_sf_rhash_Bindings_rhash_1print_1bytes
           83  +(JNIEnv *env, jclass clz, jlong ptr, jint flags) {
           84  +	Digest obj = TO_DIGEST(ptr);
           85  +	char output[130];
           86  +	int len = rhash_print_bytes(output, obj->hash_data, obj->hash_len, flags);
           87  +	jbyteArray arr = (*env)->NewByteArray(env, len);
           88  +	(*env)->SetByteArrayRegion(env, arr, 0, len, (jbyte*)output);
           89  +	return arr;
           90  +}
           91  +
           92  +
           93  +/*
           94  + * Class:     org_sf_rhash_Bindings
           95  + * Method:    rhash_print_magnet
           96  + * Signature: (JLjava/lang/String;I)Ljava/lang/String;
           97  + */
           98  +JNIEXPORT jstring JNICALL Java_org_sf_rhash_Bindings_rhash_1print_1magnet
           99  +(JNIEnv *env, jclass clz, jlong context, jstring filepath, jint flags) {
          100  +	const char* fpath = (filepath != NULL) ?
          101  +			(*env)->GetStringUTFChars(env, filepath, NULL) : NULL;
          102  +	size_t len = rhash_print_magnet(NULL, fpath, TO_RHASH(context), flags, RHPR_FILESIZE);
          103  +	char *buf = (char*)malloc(len);
          104  +	rhash_print_magnet(buf, fpath, TO_RHASH(context), flags, RHPR_FILESIZE);
          105  +	if (filepath != NULL) {
          106  +		(*env)->ReleaseStringUTFChars(env, filepath, fpath);
          107  +	}
          108  +	jstring str = (*env)->NewStringUTF(env, buf);
          109  +	free(buf);
          110  +	return str;
          111  +}
          112  +
          113  +/*
          114  + * Class:     org_sf_rhash_Bindings
          115  + * Method:    rhash_is_base32
          116  + * Signature: (I)Z
          117  + */
          118  +JNIEXPORT jboolean JNICALL Java_org_sf_rhash_Bindings_rhash_1is_1base32
          119  +(JNIEnv *env, jclass clz, jint hash_id) {
          120  +	return rhash_is_base32(hash_id);
          121  +}
          122  +
          123  +/*
          124  + * Class:     org_sf_rhash_Bindings
          125  + * Method:    rhash_get_digest_size
          126  + * Signature: (I)I
          127  + */
          128  +JNIEXPORT jint JNICALL Java_org_sf_rhash_Bindings_rhash_1get_1digest_1size
          129  +(JNIEnv *env, jclass clz, jint hash_id) {
          130  +	return rhash_get_digest_size(hash_id);
          131  +}
          132  +
          133  +/*
          134  + * Class:     org_sf_rhash_Bindings
          135  + * Method:    rhash_init
          136  + * Signature: (I)J
          137  + */
          138  +JNIEXPORT jlong JNICALL Java_org_sf_rhash_Bindings_rhash_1init
          139  +(JNIEnv *env, jclass clz, jint hash_flags) {
          140  +	rhash ctx = rhash_init(hash_flags);
          141  +	rhash_set_autofinal(ctx, 0);
          142  +	return TO_JLONG(ctx);
          143  +}
          144  +
          145  +/*
          146  + * Class:     org_sf_rhash_Bindings
          147  + * Method:    rhash_update
          148  + * Signature: (J[BII)V
          149  + */
          150  +JNIEXPORT void JNICALL Java_org_sf_rhash_Bindings_rhash_1update
          151  +(JNIEnv *env, jclass clz, jlong context, jbyteArray data, jint ofs, jint len) {
          152  +	void* msg = malloc(len);
          153  +	(*env)->GetByteArrayRegion(env, data, ofs, len, msg);
          154  +	rhash_update(TO_RHASH(context), msg, len);
          155  +	free(msg);
          156  +}
          157  +
          158  +/*
          159  + * Class:     org_sf_rhash_Bindings
          160  + * Method:    rhash_final
          161  + * Signature: (J)V
          162  + */
          163  +JNIEXPORT void JNICALL Java_org_sf_rhash_Bindings_rhash_1final
          164  +(JNIEnv *env, jclass clz, jlong context) {
          165  +	rhash_final(TO_RHASH(context), NULL);
          166  +}
          167  +
          168  +/*
          169  + * Class:     org_sf_rhash_Bindings
          170  + * Method:    rhash_reset
          171  + * Signature: (J)V
          172  + */
          173  +JNIEXPORT void JNICALL Java_org_sf_rhash_Bindings_rhash_1reset
          174  +(JNIEnv *env, jclass clz, jlong context) {
          175  +	rhash_reset(TO_RHASH(context));
          176  +}
          177  +
          178  +/*
          179  + * Class:     org_sf_rhash_Bindings
          180  + * Method:    rhash_print
          181  + * Signature: (JI)J
          182  + */
          183  +JNIEXPORT jlong JNICALL Java_org_sf_rhash_Bindings_rhash_1print
          184  +(JNIEnv *env, jclass clz, jlong context, jint hash_id) {
          185  +	Digest obj = malloc(sizeof(DigestStruct));
          186  +	obj->hash_len  = rhash_get_digest_size(hash_id);
          187  +	obj->hash_data = calloc(obj->hash_len, sizeof(unsigned char));
          188  +	rhash_print((char*)obj->hash_data, TO_RHASH(context), hash_id, RHPR_RAW);
          189  +	return TO_JLONG(obj);
          190  +}
          191  +
          192  +/*
          193  + * Class:     org_sf_rhash_Bindings
          194  + * Method:    rhash_free
          195  + * Signature: (J)V
          196  + */
          197  +JNIEXPORT void JNICALL Java_org_sf_rhash_Bindings_rhash_1free
          198  +(JNIEnv *env, jclass clz, jlong context) {
          199  +	rhash_free(TO_RHASH(context));
          200  +}
          201  +
          202  +/*
          203  + * Class:     org_sf_rhash_Bindings
          204  + * Method:    compareDigests
          205  + * Signature: (JJ)Z
          206  + */
          207  +JNIEXPORT jboolean JNICALL Java_org_sf_rhash_Bindings_compareDigests
          208  +(JNIEnv *env, jclass clz, jlong ptr1, jlong ptr2) {
          209  +	return compareDigests(TO_DIGEST(ptr1), TO_DIGEST(ptr2));
          210  +}
          211  +
          212  +/*
          213  + * Class:     org_sf_rhash_Bindings
          214  + * Method:    hashcodeForDigest
          215  + * Signature: (J)I
          216  + */
          217  +JNIEXPORT jint JNICALL Java_org_sf_rhash_Bindings_hashcodeForDigest
          218  +(JNIEnv *env, jclass clz, jlong ptr) {
          219  +	return hashcodeForDigest(TO_DIGEST(ptr));
          220  +}
          221  +
          222  +/*
          223  + * Class:     org_sf_rhash_Bindings
          224  + * Method:    freeDigest
          225  + * Signature: (J)V
          226  + */
          227  +JNIEXPORT void JNICALL Java_org_sf_rhash_Bindings_freeDigest
          228  +(JNIEnv *env, jclass clz, jlong ptr) {
          229  +	freeDigest(TO_DIGEST(ptr));
          230  +}
          231  +

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/bindings/java/native/bindings.h version [578cf87840].

            1  +/* DO NOT EDIT THIS FILE - it is machine generated */
            2  +#include <jni.h>
            3  +/* Header for class org_sf_rhash_Bindings */
            4  +
            5  +#ifndef _Included_org_sf_rhash_Bindings
            6  +#define _Included_org_sf_rhash_Bindings
            7  +#ifdef __cplusplus
            8  +extern "C" {
            9  +#endif
           10  +/*
           11  + * Class:     org_sf_rhash_Bindings
           12  + * Method:    rhash_library_init
           13  + * Signature: ()V
           14  + */
           15  +JNIEXPORT void JNICALL Java_org_sf_rhash_Bindings_rhash_1library_1init
           16  +  (JNIEnv *, jclass);
           17  +
           18  +/*
           19  + * Class:     org_sf_rhash_Bindings
           20  + * Method:    rhash_count
           21  + * Signature: ()I
           22  + */
           23  +JNIEXPORT jint JNICALL Java_org_sf_rhash_Bindings_rhash_1count
           24  +  (JNIEnv *, jclass);
           25  +
           26  +/*
           27  + * Class:     org_sf_rhash_Bindings
           28  + * Method:    rhash_msg
           29  + * Signature: (I[BII)J
           30  + */
           31  +JNIEXPORT jlong JNICALL Java_org_sf_rhash_Bindings_rhash_1msg
           32  +  (JNIEnv *, jclass, jint, jbyteArray, jint, jint);
           33  +
           34  +/*
           35  + * Class:     org_sf_rhash_Bindings
           36  + * Method:    rhash_print_bytes
           37  + * Signature: (JI)[B
           38  + */
           39  +JNIEXPORT jbyteArray JNICALL Java_org_sf_rhash_Bindings_rhash_1print_1bytes
           40  +  (JNIEnv *, jclass, jlong, jint);
           41  +
           42  +/*
           43  + * Class:     org_sf_rhash_Bindings
           44  + * Method:    rhash_print_magnet
           45  + * Signature: (JLjava/lang/String;I)Ljava/lang/String;
           46  + */
           47  +JNIEXPORT jstring JNICALL Java_org_sf_rhash_Bindings_rhash_1print_1magnet
           48  +  (JNIEnv *, jclass, jlong, jstring, jint);
           49  +
           50  +/*
           51  + * Class:     org_sf_rhash_Bindings
           52  + * Method:    rhash_is_base32
           53  + * Signature: (I)Z
           54  + */
           55  +JNIEXPORT jboolean JNICALL Java_org_sf_rhash_Bindings_rhash_1is_1base32
           56  +  (JNIEnv *, jclass, jint);
           57  +
           58  +/*
           59  + * Class:     org_sf_rhash_Bindings
           60  + * Method:    rhash_get_digest_size
           61  + * Signature: (I)I
           62  + */
           63  +JNIEXPORT jint JNICALL Java_org_sf_rhash_Bindings_rhash_1get_1digest_1size
           64  +  (JNIEnv *, jclass, jint);
           65  +
           66  +/*
           67  + * Class:     org_sf_rhash_Bindings
           68  + * Method:    rhash_init
           69  + * Signature: (I)J
           70  + */
           71  +JNIEXPORT jlong JNICALL Java_org_sf_rhash_Bindings_rhash_1init
           72  +  (JNIEnv *, jclass, jint);
           73  +
           74  +/*
           75  + * Class:     org_sf_rhash_Bindings
           76  + * Method:    rhash_update
           77  + * Signature: (J[BII)V
           78  + */
           79  +JNIEXPORT void JNICALL Java_org_sf_rhash_Bindings_rhash_1update
           80  +  (JNIEnv *, jclass, jlong, jbyteArray, jint, jint);
           81  +
           82  +/*
           83  + * Class:     org_sf_rhash_Bindings
           84  + * Method:    rhash_final
           85  + * Signature: (J)V
           86  + */
           87  +JNIEXPORT void JNICALL Java_org_sf_rhash_Bindings_rhash_1final
           88  +  (JNIEnv *, jclass, jlong);
           89  +
           90  +/*
           91  + * Class:     org_sf_rhash_Bindings
           92  + * Method:    rhash_reset
           93  + * Signature: (J)V
           94  + */
           95  +JNIEXPORT void JNICALL Java_org_sf_rhash_Bindings_rhash_1reset
           96  +  (JNIEnv *, jclass, jlong);
           97  +
           98  +/*
           99  + * Class:     org_sf_rhash_Bindings
          100  + * Method:    rhash_print
          101  + * Signature: (JI)J
          102  + */
          103  +JNIEXPORT jlong JNICALL Java_org_sf_rhash_Bindings_rhash_1print
          104  +  (JNIEnv *, jclass, jlong, jint);
          105  +
          106  +/*
          107  + * Class:     org_sf_rhash_Bindings
          108  + * Method:    rhash_free
          109  + * Signature: (J)V
          110  + */
          111  +JNIEXPORT void JNICALL Java_org_sf_rhash_Bindings_rhash_1free
          112  +  (JNIEnv *, jclass, jlong);
          113  +
          114  +/*
          115  + * Class:     org_sf_rhash_Bindings
          116  + * Method:    compareDigests
          117  + * Signature: (JJ)Z
          118  + */
          119  +JNIEXPORT jboolean JNICALL Java_org_sf_rhash_Bindings_compareDigests
          120  +  (JNIEnv *, jclass, jlong, jlong);
          121  +
          122  +/*
          123  + * Class:     org_sf_rhash_Bindings
          124  + * Method:    hashcodeForDigest
          125  + * Signature: (J)I
          126  + */
          127  +JNIEXPORT jint JNICALL Java_org_sf_rhash_Bindings_hashcodeForDigest
          128  +  (JNIEnv *, jclass, jlong);
          129  +
          130  +/*
          131  + * Class:     org_sf_rhash_Bindings
          132  + * Method:    freeDigest
          133  + * Signature: (J)V
          134  + */
          135  +JNIEXPORT void JNICALL Java_org_sf_rhash_Bindings_freeDigest
          136  +  (JNIEnv *, jclass, jlong);
          137  +
          138  +#ifdef __cplusplus
          139  +}
          140  +#endif
          141  +#endif

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/bindings/java/native/digest.c version [51337c1ec0].

            1  +/*
            2  + * This file is a part of Java Bindings for Librhash
            3  + * Copyright (c) 2011-2012, Sergey Basalaev <sbasalaev@gmail.com>
            4  + * Librhash is (c) 2011-2012, Aleksey Kravchenko <rhash.admin@gmail.com>
            5  + * 
            6  + * Permission is hereby granted, free of charge,  to any person obtaining a copy
            7  + * of this software and associated documentation files (the "Software"), to deal
            8  + * in the Software without restriction,  including without limitation the rights
            9  + * to  use,  copy,  modify,  merge, publish, distribute, sublicense, and/or sell
           10  + * copies  of  the Software,  and  to permit  persons  to whom  the Software  is
           11  + * furnished to do so.
           12  + * 
           13  + * This library  is distributed  in the hope that it will be useful, but WITHOUT
           14  + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
           15  + * FOR A PARTICULAR PURPOSE. Use it at your own risk!
           16  + */
           17  +
           18  +#include <stdlib.h>
           19  +#include <string.h>
           20  +
           21  +#include "digest.h"
           22  +
           23  +void freeDigest(Digest obj) {
           24  +	free(obj->hash_data);
           25  +	free(obj);
           26  +}
           27  +
           28  +int compareDigests(Digest o1, Digest o2) {
           29  +	if (o1->hash_len != o2->hash_len) return 0;
           30  +	return memcmp(o1->hash_data, o2->hash_data, o1->hash_len) == 0;
           31  +}
           32  +
           33  +int hashcodeForDigest(Digest obj) {
           34  +	int hash = 123321, i;
           35  +	for (i = 0; i < obj->hash_len; i++) {
           36  +		switch (i % 3) {
           37  +			case 0: hash ^= obj->hash_data[i];
           38  +			case 1: hash ^= obj->hash_data[i] << 8;
           39  +			case 2: hash ^= obj->hash_data[i] << 16;
           40  +			case 3: hash ^= obj->hash_data[i] << 24;
           41  +		}
           42  +	}
           43  +	return hash ^ (obj->hash_id + obj->hash_len);
           44  +}
           45  +

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/bindings/java/native/digest.h version [91eb796506].

            1  +/*
            2  + * This file is a part of Java Bindings for Librhash
            3  + * Copyright (c) 2011-2012, Sergey Basalaev <sbasalaev@gmail.com>
            4  + * Librhash is (c) 2011-2012, Aleksey Kravchenko <rhash.admin@gmail.com>
            5  + * 
            6  + * Permission is hereby granted, free of charge,  to any person obtaining a copy
            7  + * of this software and associated documentation files (the "Software"), to deal
            8  + * in the Software without restriction,  including without limitation the rights
            9  + * to  use,  copy,  modify,  merge, publish, distribute, sublicense, and/or sell
           10  + * copies  of  the Software,  and  to permit  persons  to whom  the Software  is
           11  + * furnished to do so.
           12  + * 
           13  + * This library  is distributed  in the hope that it will be useful, but WITHOUT
           14  + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
           15  + * FOR A PARTICULAR PURPOSE. Use it at your own risk!
           16  + */
           17  +
           18  +/* This is convenient structure to hold message digest. */
           19  +
           20  +#ifndef DIGEST_H
           21  +#define DIGEST_H
           22  +
           23  +typedef struct {
           24  +	int hash_id;
           25  +	size_t hash_len;
           26  +	unsigned char *hash_data;
           27  +} DigestStruct;
           28  +
           29  +typedef DigestStruct* Digest;
           30  +
           31  +/**
           32  + * Frees memory occupated by Digest.
           33  + * @param  obj  object to free
           34  + */
           35  +void freeDigest(Digest obj);
           36  +
           37  +/**
           38  + * Compares two Digest instances.
           39  + * @param  obj1  first object to compare
           40  + * @param  obj2  second object to compare
           41  + * @return  1 if objects are equal, 0 otherwise
           42  + */
           43  +int compareDigests(Digest obj1, Digest obj2);
           44  +
           45  +/**
           46  + * Calculates hashcode for Digest.
           47  + * @param  obj  object to calculate hash code
           48  + */
           49  +int hashcodeForDigest(Digest obj);
           50  +
           51  +#endif /* DIGEST_H */

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/bindings/java/src/org/sf/rhash/Bindings.java version [bf2e6000ad].

            1  +/*
            2  + * This file is a part of Java Bindings for Librhash
            3  + * Copyright (c) 2011-2012, Sergey Basalaev <sbasalaev@gmail.com>
            4  + * Librhash is (c) 2011-2012, Aleksey Kravchenko <rhash.admin@gmail.com>
            5  + * 
            6  + * Permission is hereby granted, free of charge,  to any person obtaining a copy
            7  + * of this software and associated documentation files (the "Software"), to deal
            8  + * in the Software without restriction,  including without limitation the rights
            9  + * to  use,  copy,  modify,  merge, publish, distribute, sublicense, and/or sell
           10  + * copies  of  the Software,  and  to permit  persons  to whom  the Software  is
           11  + * furnished to do so.
           12  + * 
           13  + * This library  is distributed  in the hope that it will be useful, but WITHOUT
           14  + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
           15  + * FOR A PARTICULAR PURPOSE. Use it at your own risk!
           16  + */
           17  +
           18  +package org.sf.rhash;
           19  +
           20  +/**
           21  + * Glue to the native API.
           22  + */
           23  +final class Bindings {
           24  +
           25  +	/** This class is not instantiable. */
           26  +	private Bindings() { }
           27  +
           28  +	/**
           29  +	 * Initializes library.
           30  +	 */
           31  +	static native void rhash_library_init();
           32  +	
           33  +	/**
           34  +	 * Returns the number of supported hash algorithms.
           35  +	 */
           36  +	static native int rhash_count();
           37  +
           38  +	/**
           39  +	 * Computes a hash of the given data.
           40  +	 *
           41  +	 * @param  hash_id  id of hash function
           42  +	 * @param  data     the data to process
           43  +	 * @param  ofs      offset in data array from which to start processing
           44  +	 * @param  len      data length
           45  +	 * @return  pointer to the native digest object
           46  +	 */
           47  +	static native long rhash_msg(int hash_id, byte[] data, int ofs, int len);
           48  +	
           49  +	/**
           50  +	 * Prints text representation of a given digest.
           51  +	 *
           52  +	 * @param  rhash  pointer to native digest object
           53  +	 * @param  flags  output flags
           54  +	 * @return  text representation as byte array
           55  +	 */
           56  +	static native byte[] rhash_print_bytes(long rhash, int flags);
           57  +
           58  +	/**
           59  +	 * Returns magnet link for given hash context and hashing algorithms.
           60  +	 * 
           61  +	 * @param  rhash     pointer to native digest object
           62  +	 * @param  filename  the name of the file to incorporate in magnet
           63  +	 * @param  flags     mask of hash_id values
           64  +	 * @return  magnet string
           65  +	 */
           66  +	static native String rhash_print_magnet(long rhash, String filename, int flags);
           67  +
           68  +	/**
           69  +	 * Tests whether given default hash algorithm output is base32.
           70  +	 * @param  hash_id  id of hash function
           71  +	 * @return <code>true</code> if default output for hash algorithm is base32,
           72  +	 *         <code>false</code> otherwise
           73  +	 */
           74  +	static native boolean rhash_is_base32(int hash_id);
           75  +
           76  +	/**
           77  +	 * Returns size of binary message digest.
           78  +	 * @param hash_id  id of hash function
           79  +	 * @return  size of message digest
           80  +	 */
           81  +	static native int rhash_get_digest_size(int hash_id);
           82  +
           83  +	/**
           84  +	 * Creates new hash context.
           85  +	 * @param  flags  mask of hash_id values
           86  +	 * @return  pointer to the native hash context
           87  +	 */
           88  +	static native long rhash_init(int flags);
           89  +
           90  +	/**
           91  +	 * Updates hash context with given data.
           92  +	 * @param rhash  pointer to native hash context
           93  +	 * @param data   data to process
           94  +	 * @param ofs    index of the first byte to process
           95  +	 * @param len    count of bytes to process
           96  +	 */
           97  +	static native void rhash_update(long rhash, byte[] data, int ofs, int len);
           98  +
           99  +	/**
          100  +	 * Finalizes hash context.
          101  +	 * @param rhash  pointer to native hash context
          102  +	 */
          103  +	static native void rhash_final(long rhash);
          104  +
          105  +	/**
          106  +	 * Resets hash context.
          107  +	 * @param rhash  pointer to native hash context
          108  +	 */
          109  +	static native void rhash_reset(long rhash);
          110  +
          111  +	/**
          112  +	 * Generates message digest for given context and hash_id.
          113  +	 * @param  rhash    pointer to native hash context
          114  +	 * @param  hash_id  id of hashing algorithm
          115  +	 * @return  pointer to native digest
          116  +	 */
          117  +	static native long rhash_print(long rhash, int hash_id);
          118  +
          119  +	/**
          120  +	 * Frees hash context.
          121  +	 * @param rhash  pointer to native hash context
          122  +	 */
          123  +	static native void rhash_free(long rhash);
          124  +
          125  +	/**
          126  +	 * Compares two native hash objects.
          127  +	 * @param  hash1  pointer to first object
          128  +	 * @param  hash2  pointer to second object
          129  +	 * @return  <code>true</code> if objects are the same,
          130  +	 *          <code>false</code> otherwise
          131  +	 */
          132  +	static native boolean compareDigests(long hash1, long hash2);
          133  +
          134  +	/**
          135  +	 * Computes hashcode for native digest object.
          136  +	 * @param hash  pointer to first object
          137  +	 * @return  hash code for the object
          138  +	 */
          139  +	static native int hashcodeForDigest(long hash);
          140  +
          141  +	/**
          142  +	 * Frees previously created native digest object.
          143  +	 */
          144  +	static native void freeDigest(long hash);
          145  +
          146  +	static {
          147  +		System.loadLibrary("rhash-jni");
          148  +		rhash_library_init();
          149  +	}
          150  +}
          151  +

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/bindings/java/src/org/sf/rhash/Digest.java version [42a0a367c0].

            1  +/*
            2  + * This file is a part of Java Bindings for Librhash
            3  + * Copyright (c) 2011-2012, Sergey Basalaev <sbasalaev@gmail.com>
            4  + * Librhash is (c) 2011-2012, Aleksey Kravchenko <rhash.admin@gmail.com>
            5  + * 
            6  + * Permission is hereby granted, free of charge,  to any person obtaining a copy
            7  + * of this software and associated documentation files (the "Software"), to deal
            8  + * in the Software without restriction,  including without limitation the rights
            9  + * to  use,  copy,  modify,  merge, publish, distribute, sublicense, and/or sell
           10  + * copies  of  the Software,  and  to permit  persons  to whom  the Software  is
           11  + * furnished to do so.
           12  + * 
           13  + * This library  is distributed  in the hope that it will be useful, but WITHOUT
           14  + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
           15  + * FOR A PARTICULAR PURPOSE. Use it at your own risk!
           16  + */
           17  +
           18  +package org.sf.rhash;
           19  +
           20  +/**
           21  + * Message digest.
           22  + */
           23  +public final class Digest {
           24  +
           25  +	static final int RAW = 0x1;
           26  +	static final int HEX = 0x2;
           27  +	static final int BASE32 = 0x3;
           28  +	static final int BASE64 = 0x4;
           29  +	static final int UPPERCASE = 0x8;
           30  +	static final int REVERSE   = 0x10;
           31  +
           32  +	private final HashType type;
           33  +
           34  +	/** Pointer to native structure. */
           35  +	private final long digest_ptr;
           36  +
           37  +	/**
           38  +	 * Creates new <code>Digest</code>.
           39  +	 * @param ptr   pointer to the native object
           40  +	 * @param type  hash type
           41  +	 */
           42  +	Digest(long ptr, HashType type) {
           43  +		this.digest_ptr = ptr;
           44  +		this.type = type;
           45  +	}
           46  +	
           47  +	/**
           48  +	 * Returns type of hashing algorithm that produced
           49  +	 * this digest.
           50  +	 * 
           51  +	 * @return type of hashing algorithm
           52  +	 */
           53  +	public HashType hashType() {
           54  +		return type;
           55  +	}
           56  +
           57  +	/**
           58  +	 * Returns value of this digest as raw bytes.
           59  +	 * This method allocates new byte array, modifying it
           60  +	 * has no effect on this <code>Digest</code>.
           61  +	 *
           62  +	 * @return  value of this digest as raw bytes
           63  +	 * @see #hex()
           64  +	 * @see #base32()
           65  +	 * @see #base64() 
           66  +	 */
           67  +	public byte[] raw() {
           68  +		return Bindings.rhash_print_bytes(digest_ptr, RAW);
           69  +	}
           70  +
           71  +	/**
           72  +	 * Returns value of this digest as hexadecimal string.
           73  +	 *
           74  +	 * @return value of the digest as hexadecimal string
           75  +	 * @see #raw()
           76  +	 * @see #base32()
           77  +	 * @see #base64() 
           78  +	 */
           79  +	public String hex() {
           80  +		return new String(Bindings.rhash_print_bytes(digest_ptr, HEX));
           81  +	}
           82  +
           83  +	/**
           84  +	 * Returns value of this digest as base32 string.
           85  +	 *
           86  +	 * @return value of the digest as base32 string
           87  +	 * @see #raw()
           88  +	 * @see #hex()
           89  +	 * @see #base64()
           90  +	 */
           91  +	public String base32() {
           92  +		return new String(Bindings.rhash_print_bytes(digest_ptr, BASE32));
           93  +	}
           94  +
           95  +	/**
           96  +	 * Returns value of this digest as base64 string.
           97  +	 *
           98  +	 * @return value of the digest as base64 string
           99  +	 * @see #raw()
          100  +	 * @see #hex()
          101  +	 * @see #base32()
          102  +	 */
          103  +	public String base64() {
          104  +		return new String(Bindings.rhash_print_bytes(digest_ptr, BASE64));
          105  +	}
          106  +	
          107  +	/**
          108  +	 * Called by garbage collector to free native resources.
          109  +	 */
          110  +	@Override
          111  +	protected void finalize() {
          112  +		Bindings.freeDigest(digest_ptr);
          113  +	}
          114  +
          115  +	/**
          116  +	 * Returns string representation of this object.
          117  +	 * If default output for hashing algorithm is base32 then
          118  +	 * returned value is the same as if <code>base32()</code>
          119  +	 * method was called; otherwise value is the same as returned
          120  +	 * by <code>hex()</code> method.
          121  +	 *
          122  +	 * @return string representation of this object
          123  +	 * @see #base32()
          124  +	 * @see #hex() 
          125  +	 */
          126  +	@Override
          127  +	public String toString() {
          128  +		return (Bindings.rhash_is_base32(type.hashId())) ? base32() : hex();
          129  +	}
          130  +
          131  +	/**
          132  +	 * Tests whether this object equals to another one
          133  +	 * @param  obj  object to compare to
          134  +	 * @return
          135  +	 *   <code>true</code> if <code>obj</code> is <code>Digest</code>
          136  +	 *   instance with the same <code>HashType</code> and value;
          137  +	 *   otherwise <code>false</code>
          138  +	 */
          139  +	@Override
          140  +	public boolean equals(Object obj) {
          141  +		if (!(obj instanceof Digest)) return false;
          142  +		final Digest other = (Digest)obj;
          143  +		if (!this.hashType().equals(other.hashType())) return false;
          144  +		if (this.digest_ptr == other.digest_ptr) return true;
          145  +		return Bindings.compareDigests(this.digest_ptr, other.digest_ptr);
          146  +	}
          147  +
          148  +	/**
          149  +	 * Returns hash code for this object.
          150  +	 * @return hash code for the object
          151  +	 */
          152  +	@Override
          153  +	public int hashCode() {
          154  +		return Bindings.hashcodeForDigest(digest_ptr);
          155  +	}
          156  +}

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/bindings/java/src/org/sf/rhash/HashType.java version [eaaf027f07].

            1  +/*
            2  + * This file is a part of Java Bindings for Librhash
            3  + * Copyright (c) 2011-2012, 2014, Sergey Basalaev <sbasalaev@gmail.com>
            4  + * Librhash is (c) 2011-2014, Aleksey Kravchenko <rhash.admin@gmail.com>
            5  + * 
            6  + * Permission is hereby granted, free of charge,  to any person obtaining a copy
            7  + * of this software and associated documentation files (the "Software"), to deal
            8  + * in the Software without restriction,  including without limitation the rights
            9  + * to  use,  copy,  modify,  merge, publish, distribute, sublicense, and/or sell
           10  + * copies  of  the Software,  and  to permit  persons  to whom  the Software  is
           11  + * furnished to do so.
           12  + * 
           13  + * This library  is distributed  in the hope that it will be useful, but WITHOUT
           14  + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
           15  + * FOR A PARTICULAR PURPOSE. Use it at your own risk!
           16  + */
           17  +
           18  +package org.sf.rhash;
           19  +
           20  +/**
           21  + * Type of hashing algorithm.
           22  + * Supported algorithms are MD4, MD5, SHA1/SHA2, Tiger,
           23  + * DC++ TTH, BitTorrent BTIH, AICH, EDonkey 2000 hash, GOST R 34.11-94,
           24  + * RIPEMD-160, HAS-160, EDON-R 256/512, Whirlpool and Snefru-128/256.
           25  + */
           26  +public enum HashType {
           27  +	/** CRC32 checksum. */
           28  +	CRC32(1),
           29  +	/** MD4 hash. */
           30  +	MD4(1 << 1),
           31  +	/** MD5 hash. */
           32  +	MD5(1 << 2),
           33  +	/** SHA-1 hash. */
           34  +	SHA1(1 << 3),
           35  +	/** Tiger hash. */
           36  +	TIGER(1 << 4),
           37  +	/** Tiger tree hash */
           38  +	TTH(1 << 5),
           39  +	/** BitTorrent info hash. */
           40  +	BTIH(1 << 6),
           41  +	/** EDonkey 2000 hash. */
           42  +	ED2K(1 << 7),
           43  +	/** eMule AICH. */
           44  +	AICH(1 << 8),
           45  +	/** Whirlpool hash. */
           46  +	WHIRLPOOL(1 << 9),
           47  +	/** RIPEMD-160 hash. */
           48  +	RIPEMD160(1 << 10),
           49  +	/** GOST R 34.11-94. */
           50  +	GOST(1 << 11),
           51  +	GOST_CRYPTOPRO(1 << 12),
           52  +	/** HAS-160 hash. */
           53  +	HAS160(1 << 13),
           54  +	/** Snefru-128 hash. */
           55  +	SNEFRU128(1 << 14),
           56  +	/** Snefru-256 hash. */
           57  +	SNEFRU256(1 << 15),
           58  +	/** SHA-224 hash. */
           59  +	SHA224(1 << 16),
           60  +	/** SHA-256 hash. */
           61  +	SHA256(1 << 17),
           62  +	/** SHA-384 hash. */
           63  +	SHA384(1 << 18),
           64  +	/** SHA-512 hash. */
           65  +	SHA512(1 << 19),
           66  +	/** EDON-R 256. */
           67  +	EDONR256(1 << 20),
           68  +	/** EDON-R 512. */
           69  +	EDONR512(1 << 21),
           70  +	/** SHA3-224 hash. */
           71  +	SHA3_224(1 << 22),
           72  +	/** SHA3-256 hash. */
           73  +	SHA3_256(1 << 23),
           74  +	/** SHA3-384 hash. */
           75  +	SHA3_384(1 << 24),
           76  +	/** SHA3-512 hash. */
           77  +	SHA3_512(1 << 25);
           78  +
           79  +	/** hash_id for the native API */
           80  +    private int hashId;
           81  +
           82  +    /**
           83  +     * Construct HashType for specified native hash_id
           84  +     * @param hashId hash identifier for native API
           85  +     */
           86  +    private HashType(int hashId) {
           87  +        this.hashId = hashId;
           88  +    }
           89  +
           90  +	/**
           91  +	 * Returns hash_id for the native API.
           92  +     * @return hash identifier
           93  +     */
           94  +	int hashId() {
           95  +	    return hashId;
           96  +	}
           97  +
           98  +	/**
           99  +	 * Returns lowest <code>HashType</code> for given id mask.
          100  +	 * Used by <code>RHash.getDigest()</code>.
          101  +	 * @param flags  mask of hash identifiers
          102  +	 * @return  <code>HashType</code> object or <code>null</code>
          103  +	 *   if no <code>HashType</code> for given mask exists
          104  +	 */
          105  +	static HashType forHashFlags(int flags) {
          106  +		if (flags == 0) return null;
          107  +		int lowest = 0;
          108  +		while ((flags % 2) == 0) {
          109  +			flags >>>= 1;
          110  +			lowest++;
          111  +		}
          112  +		for (HashType t : HashType.values()) {
          113  +			if (t.hashId == (1 << lowest)) return t;
          114  +		}
          115  +		return null;
          116  +	}
          117  +
          118  +	/**
          119  +	 * Returns size of binary digest for this type.
          120  +	 * @return size of binary digest, in bytes
          121  +	 */
          122  +	public int getDigestSize() {
          123  +		//TODO: rhash_get_digest_size
          124  +		return -1;
          125  +	}
          126  +}

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/bindings/java/src/org/sf/rhash/RHash.java version [f1b2e974c8].

            1  +/*
            2  + * This file is a part of Java Bindings for Librhash
            3  + * Copyright (c) 2011-2012, Sergey Basalaev <sbasalaev@gmail.com>
            4  + * Librhash is (c) 2011-2012, Aleksey Kravchenko <rhash.admin@gmail.com>
            5  + * 
            6  + * Permission is hereby granted, free of charge,  to any person obtaining a copy
            7  + * of this software and associated documentation files (the "Software"), to deal
            8  + * in the Software without restriction,  including without limitation the rights
            9  + * to  use,  copy,  modify,  merge, publish, distribute, sublicense, and/or sell
           10  + * copies  of  the Software,  and  to permit  persons  to whom  the Software  is
           11  + * furnished to do so.
           12  + * 
           13  + * This library  is distributed  in the hope that it will be useful, but WITHOUT
           14  + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
           15  + * FOR A PARTICULAR PURPOSE. Use it at your own risk!
           16  + */
           17  +
           18  +package org.sf.rhash;
           19  +
           20  +import java.io.File;
           21  +import java.io.FileInputStream;
           22  +import java.io.IOException;
           23  +import java.io.InputStream;
           24  +import java.io.UnsupportedEncodingException;
           25  +import java.util.Set;
           26  +
           27  +/**
           28  + * Incremental hasher.
           29  + * This class allows you to do incremental hashing for set
           30  + * of hashing algorithms.
           31  + * <p>
           32  + * To do hashing <code>RHash</code> instance is first created
           33  + * and then filled with message chunks using <code>update()</code>
           34  + * methods. Finally, <code>finish()</code> should be called to end
           35  + * all calculations and generate digests, which then can be obtained
           36  + * with <code>getDigest()</code> method. Note, that trying to update
           37  + * finished <code>RHash</code> has no effect other than throwing
           38  + * <code>IllegalStateException</code> though you can reuse this class
           39  + * by calling <code>reset()</code> method, returning it to the state
           40  + * which was immediately after creating.
           41  + * </p><p>
           42  + * To quickly produce message digest for a single message/file
           43  + * and a single algorithm you may use convenience methods
           44  + * <code>RHash.computeHash()</code>.
           45  + * </p><p>
           46  + * This class is thread safe.
           47  + * </p>
           48  + */
           49  +public final class RHash {
           50  +
           51  +	/* == EXCEPTION MESSAGES == */
           52  +
           53  +	static private final String ERR_FINISHED   = "RHash is finished, data update is not possible";
           54  +	static private final String ERR_NOHASH     = "No HashTypes specified";
           55  +	static private final String ERR_UNFINISHED = "RHash should be finished before generating Digest";
           56  +	static private final String ERR_WRONGTYPE  = "RHash was not created to generate Digest for ";
           57  +
           58  +	/**
           59  +	 * Computes hash of given range in data.
           60  +	 * This method calculates message digest for byte subsequence
           61  +	 * in array <code>data</code> starting from <code>data[ofs]</code>
           62  +	 * and ending at <code>data[ofs+len-1]</code>.
           63  +	 * 
           64  +	 * @param  type  type of hash algorithm
           65  +	 * @param  data  the bytes to process
           66  +	 * @param  ofs   index of the first byte in array to process
           67  +	 * @param  len   count of bytes to process
           68  +	 * @return  message digest for specified subarray
           69  +	 * @throws NullPointerException
           70  +	 *   if either <code>type</code> or <code>data</code>
           71  +	 *   is <code>null</code>
           72  +	 * @throws IndexOutOfBoundsException
           73  +	 *   if <code>ofs &lt; 0</code>, <code>len &lt; 0</code> or
           74  +	 *   <code>ofs+len &gt; data.length</code>
           75  +	 */
           76  +	static public Digest computeHash(HashType type, byte[] data, int ofs, int len) {
           77  +		if (type == null || data == null) {
           78  +			throw new NullPointerException();
           79  +		}
           80  +		if (ofs < 0 || len < 0 || ofs+len > data.length) {
           81  +			throw new IndexOutOfBoundsException();
           82  +		}
           83  +		return new Digest(Bindings.rhash_msg(type.hashId(), data, ofs, len), type);
           84  +	}
           85  +	
           86  +	/**
           87  +	 * Computes hash of given data.
           88  +	 * 
           89  +	 * @param  type  type of hash algorithm
           90  +	 * @param  data  the bytes to process
           91  +	 * @return  message digest for specified array
           92  +	 * @throws NullPointerException
           93  +	 *   if either <code>type</code> or <code>data</code>
           94  +	 *   is <code>null</code>
           95  +	 */
           96  +	static public Digest computeHash(HashType type, byte[] data) {
           97  +		return computeHash(type, data, 0, data.length);
           98  +	}
           99  +
          100  +	/**
          101  +	 * Computes hash of given string.
          102  +	 * String is encoded into a sequence of bytes
          103  +	 * using the specified charset.
          104  +	 *
          105  +	 * @param  type      type of hash algorithm
          106  +	 * @param  str       the string to process
          107  +	 * @param  encoding  encoding to use
          108  +	 * @return  message digest for specified string
          109  +	 * @throws NullPointerException if any of arguments is <code>null</code>
          110  +	 * @throws UnsupportedEncodingException if specified encoding is not supported
          111  +	 */
          112  +	static public Digest computeHash(HashType type, String str, String encoding)
          113  +			throws UnsupportedEncodingException {
          114  +		if (type == null || str == null || encoding == null) {
          115  +			throw new NullPointerException();
          116  +		}
          117  +		return computeHash(type, str.getBytes(encoding));
          118  +	}
          119  +
          120  +	/**
          121  +	 * Computes hash of given string.
          122  +	 * String is encoded into a sequence of bytes using the
          123  +	 * default platform encoding.
          124  +	 *
          125  +	 * @param  type  type of hash algorithm
          126  +	 * @param  str   the string to process
          127  +	 * @return  message digest for specified string
          128  +	 * @throws NullPointerException if any of arguments is <code>null</code>
          129  +	 */
          130  +	static public Digest computeHash(HashType type, String str) {
          131  +		if (type == null || str == null) throw new NullPointerException();
          132  +		return computeHash(type, str.getBytes());
          133  +	}
          134  +
          135  +	/**
          136  +	 * Computes hash of given string.
          137  +	 * @param  type  type of hash algorithm
          138  +	 * @param  file  the file to process
          139  +	 * @return  data hash
          140  +	 * @throws NullPointerException if any of arguments is <code>null</code>
          141  +	 * @throws IOException
          142  +	 *   if an I/O error occurs while hashing
          143  +	 */
          144  +	static public Digest computeHash(HashType type, File file) throws IOException {
          145  +		if (type == null || file == null) {
          146  +			throw new NullPointerException();
          147  +		}
          148  +		RHash hasher = new RHash(type);
          149  +		hasher.update(file).finish();
          150  +		return hasher.getDigest();
          151  +	}
          152  +	
          153  +	/**
          154  +	 * Produces magnet link for specified file with given hashes.
          155  +	 *
          156  +	 * @param  filename   the file to generate magnet for
          157  +	 * @param  types      types of hashing algorithms
          158  +	 */
          159  +	static public String getMagnetFor(String filename, HashType... types) throws IOException {
          160  +		RHash hasher = new RHash(types);
          161  +		hasher.update(new File(filename)).finish();
          162  +		return hasher.getMagnet(filename);
          163  +	}
          164  +	
          165  +	/**
          166  +	 * Produces magnet link for specified file with given hashes.
          167  +	 *
          168  +	 * @param  filename   the file to generate magnet for
          169  +	 * @param  types      set of hashing types
          170  +	 */
          171  +	static public String getMagnetFor(String filename, Set<HashType> types) throws IOException {
          172  +		RHash hasher = new RHash(types);
          173  +		hasher.update(new File(filename)).finish();
          174  +		return hasher.getMagnet(filename);
          175  +	}
          176  +
          177  +	/** Indicates whether this <code>RHash</code> is finished. */
          178  +	private boolean finished = false;
          179  +
          180  +	/** Mask of hash_id values. */
          181  +	private final int hash_flags;
          182  +
          183  +	/** Pointer to the native hash context. */
          184  +	private final long context_ptr;
          185  +
          186  +	/** Default hash type used in <code>getDigest()</code>. */
          187  +	private final HashType deftype;
          188  +
          189  +	/**
          190  +	 * Creates new <code>RHash</code> to compute
          191  +	 * message digests for given types.
          192  +	 * @param  types  types of hashing algorithms
          193  +	 * @throws NullPointerException
          194  +	 *   if any of arguments is <code>null</code>
          195  +	 * @throws IllegalArgumentException
          196  +	 *   if zero hash types specified
          197  +	 */
          198  +	public RHash(HashType... types) {
          199  +		if (types.length == 0) {
          200  +			throw new IllegalArgumentException(ERR_NOHASH);
          201  +		}
          202  +		int flags = 0;
          203  +		HashType def = types[0];
          204  +		for (HashType t : types) {
          205  +			flags |= t.hashId();
          206  +			if (def.compareTo(t) > 0) def = t;
          207  +		}
          208  +		this.deftype = def;
          209  +		this.hash_flags = flags;
          210  +		this.context_ptr = Bindings.rhash_init(flags);
          211  +	}
          212  +
          213  +	/**
          214  +	 * Creates new <code>RHash</code> to compute
          215  +	 * message digests for given types.
          216  +	 * @param  types  set of hashing types
          217  +	 * @throws NullPointerException
          218  +	 *   if argument is <code>null</code>
          219  +	 * @throws IllegalArgumentException
          220  +	 *   if argument is empty set
          221  +	 */
          222  +	public RHash(Set<HashType> types) {
          223  +		if (types.isEmpty()) {
          224  +			throw new IllegalArgumentException(ERR_NOHASH);
          225  +		}
          226  +		int flags = 0;
          227  +		HashType def = null;
          228  +		for (HashType t : types) {
          229  +			flags |= t.hashId();
          230  +			if (def == null || def.compareTo(t) > 0) def = t;
          231  +		}
          232  +		this.deftype = def;
          233  +		this.hash_flags = flags;
          234  +		this.context_ptr = Bindings.rhash_init(flags);
          235  +	}
          236  +
          237  +	/**
          238  +	 * Updates this <code>RHash</code> with new data chunk.
          239  +	 * This method hashes bytes from <code>data[ofs]</code>
          240  +	 * through <code>data[ofs+len-1]</code>.
          241  +	 * 
          242  +	 * @param  data  data to be hashed
          243  +	 * @param  ofs   index of the first byte to hash
          244  +	 * @param  len   number of bytes to hash
          245  +	 * @return  this object
          246  +	 * @throws NullPointerException
          247  +	 *   if <code>data</code> is <code>null</code>
          248  +	 * @throws IndexOutOfBoundsException
          249  +	 *   if <code>ofs &lt; 0</code>, <code>len &lt; 0</code> or
          250  +	 *   <code>ofs+len &gt; data.length</code>
          251  +	 * @throws IllegalStateException
          252  +	 *   if <code>finish()</code> was called and there were no
          253  +	 *   subsequent calls of <code>reset()</code>
          254  +	 */
          255  +	public synchronized RHash update(byte[] data, int ofs, int len) {
          256  +		if (finished) {
          257  +			throw new IllegalStateException(ERR_FINISHED);
          258  +		}
          259  +		if (ofs < 0 || len < 0 || ofs+len > data.length) {
          260  +			throw new IndexOutOfBoundsException();
          261  +		}
          262  +		Bindings.rhash_update(context_ptr, data, ofs, len);
          263  +		return this;
          264  +	}
          265  +
          266  +	/**
          267  +	 * Updates this <code>RHash</code> with new data chunk.
          268  +	 * This method has the same effect as
          269  +	 * <pre>update(data, 0, data.length)</pre>
          270  +	 *
          271  +	 * @param  data  data to be hashed
          272  +	 * @return  this object
          273  +	 * @throws NullPointerException
          274  +	 *   if <code>data</code> is <code>null</code>
          275  +	 * @throws IllegalStateException
          276  +	 *   if <code>finish()</code> was called and there were no
          277  +	 *   subsequent calls of <code>reset()</code>
          278  +	 */
          279  +	public RHash update(byte[] data) {
          280  +		return update(data, 0, data.length);
          281  +	}
          282  +
          283  +	/**
          284  +	 * Updates this <code>RHash</code> with new data chunk.
          285  +	 * String is encoded into a sequence of bytes using the
          286  +	 * default platform encoding.
          287  +	 * 
          288  +	 * @param str  string to be hashed
          289  +	 * @return this object
          290  +	 * @throws NullPointerException
          291  +	 *   if <code>str</code> is <code>null</code>
          292  +	 * @throws IllegalStateException
          293  +	 *   if <code>finish()</code> was called and there were no
          294  +	 *   subsequent calls of <code>reset()</code>
          295  +	 */
          296  +	public RHash update(String str) {
          297  +		return update(str.getBytes());
          298  +	}
          299  +
          300  +	/**
          301  +	 * Updates this <code>RHash</code> with data from given file.
          302  +	 * 
          303  +	 * @param  file  file to be hashed
          304  +	 * @return this object
          305  +	 * @throws IOException if an I/O error occurs
          306  +	 * @throws NullPointerException
          307  +	 *   if <code>file</code> is <code>null</code>
          308  +	 * @throws IllegalStateException
          309  +	 *   if <code>finish()</code> was called and there were no
          310  +	 *   subsequent calls of <code>reset()</code>
          311  +	 */
          312  +	public synchronized RHash update(File file) throws IOException {
          313  +		if (finished) {
          314  +			throw new IllegalStateException(ERR_FINISHED);
          315  +		}
          316  +		InputStream in = new FileInputStream(file);
          317  +		byte[] buf = new byte[8192];  //shouldn't we avoid magic numbers?
          318  +		int len = in.read(buf);
          319  +		while (len > 0) {
          320  +			this.update(buf, 0, len);
          321  +			len = in.read(buf);
          322  +		}
          323  +		in.close();
          324  +		return this;
          325  +	}
          326  +
          327  +	/**
          328  +	 * Finishes calculation of hash codes.
          329  +	 * Does nothing if <code>RHash</code> is already finished.
          330  +	 */
          331  +	public synchronized void finish() {
          332  +		if (!finished) {
          333  +			Bindings.rhash_final(context_ptr);
          334  +			finished = true;
          335  +		}
          336  +	}
          337  +
          338  +	/**
          339  +	 * Resets this <code>RHash</code> to initial state.
          340  +	 * The <code>RHash</code> becomes available to process
          341  +	 * new data chunks. Note, that this method returns
          342  +	 * <code>RHash</code> to the state after creating the
          343  +	 * object, NOT the state when hashing continues.
          344  +	 * Therefore, all previously calculated hashes are lost
          345  +	 * and process starts from the very beginning.
          346  +	 */
          347  +	public synchronized void reset() {
          348  +		Bindings.rhash_reset(context_ptr);
          349  +		finished = false;
          350  +	}
          351  +
          352  +	/**
          353  +	 * Tests whether this <code>RHash</code> is finished or not.
          354  +	 * @return
          355  +	 *   <code>false</code> if this <code>RHash</code> is ready to
          356  +	 *   receive new data for hashing;
          357  +	 *   <code>true</code> if hash calculations are finished
          358  +	 */
          359  +	public boolean isFinished() {
          360  +		return finished;
          361  +	}
          362  +
          363  +	/**
          364  +	 * Returns digest for given hash type.
          365  +	 * 
          366  +	 * @param type  hash type
          367  +	 * @return  <code>Digest</code> for processed data
          368  +	 * @throws NullPointerException
          369  +	 *   if <code>type</code> is <code>null</code>
          370  +	 * @throws IllegalStateException
          371  +	 *   if this <code>RHash</code> is not finished
          372  +	 * @throws IllegalArgumentException
          373  +	 *   if this <code>RHash</code> was not created to calculate
          374  +	 *   hash for specified algorithm
          375  +	 */
          376  +	public Digest getDigest(HashType type) {
          377  +		if (type == null) {
          378  +			throw new NullPointerException();
          379  +		}
          380  +		if (!finished) {
          381  +			throw new IllegalStateException(ERR_UNFINISHED);
          382  +		}
          383  +		if ((hash_flags & type.hashId()) == 0) {
          384  +			throw new IllegalArgumentException(ERR_WRONGTYPE+type);
          385  +		}
          386  +		return new Digest(Bindings.rhash_print(context_ptr, type.hashId()), type);
          387  +	}
          388  +
          389  +	/**
          390  +	 * Returns digest for processed data.
          391  +	 * If more than one hashing type was passed to the
          392  +	 * <code>RHash</code> constructor, then the least
          393  +	 * hash type (in the order induced by
          394  +	 * {@link Enum#compareTo(Enum) compareTo()}) is used.
          395  +	 * 
          396  +	 * @return <code>Digest</code> for processed data
          397  +	 * @throws IllegalStateException
          398  +	 *   if this <code>RHash</code> is not finished
          399  +	 */
          400  +	public Digest getDigest() {
          401  +		return getDigest(deftype);
          402  +	}
          403  +	
          404  +	/**
          405  +	 * Returns magnet link that includes specified filename
          406  +	 * and hashes for given algorithms. Only hashes that were
          407  +	 * computed by this <code>RHash</code> are included.
          408  +	 *
          409  +	 * @param  filename  file name to include in magnet, may be <code>null</code>
          410  +	 * @return magnet link
          411  +	 * @throws IllegalStateException
          412  +	 *   if this <code>RHash</code> is not finished
          413  +	 */
          414  +	public String getMagnet(String filename, HashType... types) {
          415  +		if (!finished) {
          416  +			throw new IllegalStateException(ERR_UNFINISHED);
          417  +		}
          418  +		int flags = 0;
          419  +		for (HashType t : types) {
          420  +			flags |= t.hashId();
          421  +		}
          422  +		return Bindings.rhash_print_magnet(context_ptr, filename, flags);
          423  +	}
          424  +
          425  +	/**
          426  +	 * Returns magnet link for given filename.
          427  +	 * Magnet includes all hashes that were computed
          428  +	 * by this <code>RHash</code>.
          429  +	 * 
          430  +	 * @param  filename  file name to include in magnet, may be <code>null</code>
          431  +	 * @return magnet link
          432  +	 * @throws IllegalStateException
          433  +	 *   if this <code>RHash</code> is not finished
          434  +	 */
          435  +	public String getMagnet(String filename) {
          436  +		if (!finished) {
          437  +			throw new IllegalStateException(ERR_UNFINISHED);
          438  +		}
          439  +		return Bindings.rhash_print_magnet(context_ptr, filename, hash_flags);
          440  +	}
          441  +	
          442  +	/**
          443  +	 * Called by garbage collector to free native resources.
          444  +	 */
          445  +	@Override
          446  +	protected void finalize() {
          447  +		Bindings.rhash_free(context_ptr);
          448  +	}
          449  +}

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/bindings/java/src/org/sf/rhash/package-info.java version [32f1f3b740].

            1  +/*
            2  + * This file is a part of Java Bindings for Librhash
            3  + * Copyright (c) 2011-2012, Sergey Basalaev <sbasalaev@gmail.com>
            4  + * Librhash is (c) 2011-2012, Aleksey Kravchenko <rhash.admin@gmail.com>
            5  + * 
            6  + * Permission is hereby granted, free of charge,  to any person obtaining a copy
            7  + * of this software and associated documentation files (the "Software"), to deal
            8  + * in the Software without restriction,  including without limitation the rights
            9  + * to  use,  copy,  modify,  merge, publish, distribute, sublicense, and/or sell
           10  + * copies  of  the Software,  and  to permit  persons  to whom  the Software  is
           11  + * furnished to do so.
           12  + * 
           13  + * This library  is distributed  in the hope that it will be useful, but WITHOUT
           14  + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
           15  + * FOR A PARTICULAR PURPOSE. Use it at your own risk!
           16  + */
           17  +
           18  +/**
           19  + * Java bindings for librhash.
           20  + * Librhash is a library for computing and verifying hash sums.
           21  + * List of all supported hash functions can be found in
           22  + * {@link org.sf.rhash.HashType} class description.
           23  + * <p>
           24  + * In its simplest usage to calculate a hash for message or file
           25  + * you just need to use one of <code>RHash.computeHash()</code>
           26  + * methods:
           27  + * <pre>
           28  + *     RHash.computeHash("Hello, world!");
           29  + *     RHash.computeHash(new byte[] { 0, 1, 2, 3});
           30  + *     RHash.computeHash(new File("SomeFile.txt"));</pre>
           31  + * These methods return value of type <code>Digest</code> which is
           32  + * a message digest. To convert <code>Digest</code> in human readable
           33  + * format you might use one of methods
           34  + * {@link org.sf.rhash.Digest#hex() hex()},
           35  + * {@link org.sf.rhash.Digest#base32() base32()},
           36  + * {@link org.sf.rhash.Digest#base64() base64()} or
           37  + * {@link org.sf.rhash.Digest#raw() raw()}.
           38  + * </p><p>
           39  + * Next, <code>RHash</code> allows you to do incremental hashing,
           40  + * processing data given in portions like it was one big byte sequence.
           41  + * To do this you first need to create <code>RHash</code> instance
           42  + * with a set of needed hash algorithms and then to fill it using
           43  + * <code>update()</code>:
           44  + * <pre>
           45  + *     RHash hasher = new RHash(HashType.MD5);
           46  + *     hasher.update("Foo").update(new File("Bar.zip")).finish();
           47  + *     Digest result = hasher.getDigest();</pre>
           48  + * Method <code>finish()</code> should be called before obtaining
           49  + * digest to end all calculations and generate result.
           50  + * </p><p>
           51  + * You can setup <code>RHash</code> to calculate several digests
           52  + * at once, passing corresponding <code>HashType</code>s in
           53  + * constructor. Specifically, you can calculate all of them creating
           54  + * <code>RHash</code> like
           55  + * <pre>
           56  + *     new Rhash(EnumSet.allOf(HashType.class));</pre>
           57  + * In this case to obtain digest for particular hash type use
           58  + * {@link org.sf.rhash.RHash#getDigest(HashType) }
           59  + * method.
           60  + * </p>
           61  + */
           62  +package org.sf.rhash;

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/bindings/java/test/RHashTest.java version [c9b556e8aa].

            1  +import java.io.File;
            2  +import java.io.IOException;
            3  +import java.io.PrintStream;
            4  +import java.util.EnumSet;
            5  +
            6  +import org.sf.rhash.*;
            7  +import static org.sf.rhash.HashType.*;
            8  +
            9  +import org.junit.Test;
           10  +import junit.framework.JUnit4TestAdapter;
           11  +import static junit.framework.TestCase.*;
           12  +
           13  +public class RHashTest {
           14  +
           15  +	@Test
           16  +	public void testAllHashes() {
           17  +		RHash r = new RHash(EnumSet.allOf(HashType.class));
           18  +		r.update("a").finish();
           19  +		
           20  +		assertEquals("e8b7be43", r.getDigest(CRC32).toString());
           21  +		assertEquals("bde52cb31de33e46245e05fbdbd6fb24", r.getDigest(MD4).toString());
           22  +		assertEquals("0cc175b9c0f1b6a831c399e269772661", r.getDigest(MD5).toString());
           23  +		assertEquals("86f7e437faa5a7fce15d1ddcb9eaeaea377667b8", r.getDigest(SHA1).toString());
           24  +		assertEquals("77befbef2e7ef8ab2ec8f93bf587a7fc613e247f5f247809", r.getDigest(TIGER).toString());
           25  +		assertEquals("czquwh3iyxbf5l3bgyugzhassmxu647ip2ike4y", r.getDigest(TTH).toString());
           26  +		assertEquals(40, r.getDigest(BTIH).toString().length());
           27  +		assertEquals("bde52cb31de33e46245e05fbdbd6fb24", r.getDigest(ED2K).toString());
           28  +		assertEquals("q336in72uwt7zyk5dxolt2xk5i3xmz5y", r.getDigest(AICH).toString());
           29  +		assertEquals("8aca2602792aec6f11a67206531fb7d7f0dff59413145e6973c45001d0087b42d11bc645413aeff63a42391a39145a591a92200d560195e53b478584fdae231a", r.getDigest(WHIRLPOOL).toString());
           30  +		assertEquals("0bdc9d2d256b3ee9daae347be6f4dc835a467ffe", r.getDigest(RIPEMD160).toString());
           31  +		assertEquals("d42c539e367c66e9c88a801f6649349c21871b4344c6a573f849fdce62f314dd", r.getDigest(GOST).toString());
           32  +		assertEquals("e74c52dd282183bf37af0079c9f78055715a103f17e3133ceff1aacf2f403011", r.getDigest(GOST_CRYPTOPRO).toString());
           33  +		assertEquals("4872bcbc4cd0f0a9dc7c2f7045e5b43b6c830db8", r.getDigest(HAS160).toString());
           34  +		assertEquals("bf5ce540ae51bc50399f96746c5a15bd", r.getDigest(SNEFRU128).toString());
           35  +		assertEquals("45161589ac317be0ceba70db2573ddda6e668a31984b39bf65e4b664b584c63d", r.getDigest(SNEFRU256).toString());
           36  +		assertEquals("abd37534c7d9a2efb9465de931cd7055ffdb8879563ae98078d6d6d5", r.getDigest(SHA224).toString());
           37  +		assertEquals("ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb", r.getDigest(SHA256).toString());
           38  +		assertEquals("54a59b9f22b0b80880d8427e548b7c23abd873486e1f035dce9cd697e85175033caa88e6d57bc35efae0b5afd3145f31", r.getDigest(SHA384).toString());
           39  +		assertEquals("1f40fc92da241694750979ee6cf582f2d5d7d28e18335de05abc54d0560e0f5302860c652bf08d560252aa5e74210546f369fbbbce8c12cfc7957b2652fe9a75", r.getDigest(SHA512).toString());
           40  +		assertEquals("943aa9225a2cf154ec2e4dd81237720ba538ca8df2fd83c0b893c5d265f353a0", r.getDigest(EDONR256).toString());
           41  +		assertEquals("b59ec44f7beef8a04ceed38a973d77c65e22e9458d5f67b497948da34986c093b5efc5483fbee55f2f740fcad31f18d80db44bb6b8843e7fd599188e7c07233b", r.getDigest(EDONR512).toString());
           42  +		assertEquals("9e86ff69557ca95f405f081269685b38e3a819b309ee942f482b6a8b", r.getDigest(SHA3_224).toString());
           43  +		assertEquals("80084bf2fba02475726feb2cab2d8215eab14bc6bdd8bfb2c8151257032ecd8b", r.getDigest(SHA3_256).toString());
           44  +		assertEquals("1815f774f320491b48569efec794d249eeb59aae46d22bf77dafe25c5edc28d7ea44f93ee1234aa88f61c91912a4ccd9", r.getDigest(SHA3_384).toString());
           45  +		assertEquals("697f2d856172cb8309d6b8b97dac4de344b549d4dee61edfb4962d8698b7fa803f4f93ff24393586e28b5b957ac3d1d369420ce53332712f997bd336d09ab02a", r.getDigest(SHA3_512).toString());
           46  +
           47  +		r.reset();
           48  +		r.finish();
           49  +		assertEquals("d41d8cd98f00b204e9800998ecf8427e", r.getDigest(MD5).toString()); // MD5 of ""
           50  +	}
           51  +
           52  +	@Test
           53  +	public void testMagnet() {
           54  +		RHash r = new RHash(MD5, TTH);
           55  +		r.update("abc").finish();
           56  +		assertEquals("magnet:?xl=3&dn=file.txt&xt=urn:md5:900150983cd24fb0d6963f7d28e17f72&xt=urn:tree:tiger:asd4ujseh5m47pdyb46kbtsqtsgdklbhyxomuia", r.getMagnet("file.txt"));
           57  +    }
           58  +
           59  +	@Test
           60  +	public void testUpdateFile() throws IOException {
           61  +		File f = new File("java_test_input_123.txt");
           62  +		PrintStream out = new PrintStream(f);
           63  +		out.println("\0\1\2");
           64  +		out.flush();
           65  +		out.close();
           66  +		assertEquals("e3869ec477661fad6b9fc25914bb2eee5455b483", RHash.computeHash(SHA1, f).toString());
           67  +		f.delete();
           68  +    }
           69  +
           70  +	public static junit.framework.Test suite(){
           71  +		return new JUnit4TestAdapter(RHashTest.class);
           72  +	}
           73  +}

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/bindings/mono/.gitignore version [a07c210e92].

            1  +bin
            2  +RHash.dll
            3  +RHash.dll.mdb
            4  +RHash.pidb
            5  +RHash.tree
            6  +RHash.userprefs
            7  +RHash.zip
            8  +html

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/bindings/mono/AssemblyInfo.cs version [e23dec91ff].

            1  +/*
            2  + * This file is a part of Mono Bindings for Librhash
            3  + * Copyright (c) 2011-2012, Sergey Basalaev <sbasalaev@gmail.com>
            4  + * Librhash is (c) 2011-2012, Aleksey Kravchenko <rhash.admin@gmail.com>
            5  + * 
            6  + * Permission is hereby granted, free of charge,  to any person obtaining a copy
            7  + * of this software and associated documentation files (the "Software"), to deal
            8  + * in the Software without restriction,  including without limitation the rights
            9  + * to  use,  copy,  modify,  merge, publish, distribute, sublicense, and/or sell
           10  + * copies  of  the Software,  and  to permit  persons  to whom  the Software  is
           11  + * furnished to do so.
           12  + * 
           13  + * This library  is distributed  in the hope that it will be useful, but WITHOUT
           14  + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
           15  + * FOR A PARTICULAR PURPOSE. Use it at your own risk!
           16  + */
           17  +
           18  +using System.Reflection;
           19  +using System.Runtime.CompilerServices;
           20  +
           21  +// Information about this assembly is defined by the following attributes. 
           22  +// Change them to the values specific to your project.
           23  +
           24  +[assembly: AssemblyTitle("RHash")]
           25  +[assembly: AssemblyDescription(".NET/Mono bindings for librhash")]
           26  +[assembly: AssemblyConfiguration("")]
           27  +[assembly: AssemblyCompany("")]
           28  +[assembly: AssemblyProduct("")]
           29  +[assembly: AssemblyCopyright("(c) 2011, Sergey Basalaev")]
           30  +[assembly: AssemblyTrademark("")]
           31  +[assembly: AssemblyCulture("")]
           32  +
           33  +// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
           34  +// The form "{Major}.{Minor}.*" will automatically update the build and revision,
           35  +// and "{Major}.{Minor}.{Build}.*" will update just the revision.
           36  +
           37  +[assembly: AssemblyVersion("1.0.1.1")]
           38  +
           39  +// The following attributes are used to specify the signing key for the assembly, 
           40  +// if desired. See the Mono documentation for more information about signing.
           41  +
           42  +[assembly: AssemblyDelaySign(false)]
           43  +//[assembly: AssemblyKeyFile("RHash.snk")]
           44  +

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/bindings/mono/Bindings.cs version [bce7748376].

            1  +/*
            2  + * This file is a part of Mono Bindings for Librhash
            3  + * Copyright (c) 2011-2012, Sergey Basalaev <sbasalaev@gmail.com>
            4  + * Librhash is (c) 2011-2012, Aleksey Kravchenko <rhash.admin@gmail.com>
            5  + * 
            6  + * Permission is hereby granted, free of charge,  to any person obtaining a copy
            7  + * of this software and associated documentation files (the "Software"), to deal
            8  + * in the Software without restriction,  including without limitation the rights
            9  + * to  use,  copy,  modify,  merge, publish, distribute, sublicense, and/or sell
           10  + * copies  of  the Software,  and  to permit  persons  to whom  the Software  is
           11  + * furnished to do so.
           12  + * 
           13  + * This library  is distributed  in the hope that it will be useful, but WITHOUT
           14  + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
           15  + * FOR A PARTICULAR PURPOSE. Use it at your own risk!
           16  + */
           17  +
           18  +using System;
           19  +using System.Runtime.InteropServices;
           20  +using System.Text;
           21  +
           22  +namespace RHash {
           23  +	/* Pointer to native structure. */
           24  +	sealed class Bindings {
           25  +		
           26  +		private const string librhash = "librhash.dll";
           27  +
           28  +		private Bindings() { }
           29  +		
           30  +		static Bindings() {
           31  +			rhash_library_init();
           32  +		}
           33  +
           34  +		[DllImport (librhash)]
           35  +		public static extern
           36  +			void rhash_library_init();
           37  +		
           38  +		[DllImport (librhash)]
           39  +		public static extern
           40  +			IntPtr rhash_init(uint hash_ids);
           41  +		
           42  +		[DllImport (librhash)]
           43  +		public static extern
           44  +			void rhash_update(IntPtr ctx, byte[] message, int length);
           45  +		
           46  +		//may crash, rhash_final actually have 2 arguments
           47  +		[DllImport (librhash)]
           48  +		public static extern
           49  +			void rhash_final(IntPtr ctx, IntPtr unused);
           50  +
           51  +		[DllImport (librhash)]
           52  +		public static extern
           53  +			void rhash_reset(IntPtr ctx);
           54  +		
           55  +		[DllImport (librhash)]
           56  +		public static extern
           57  +			void rhash_free(IntPtr ctx);
           58  +		
           59  +		[DllImport (librhash, CharSet=CharSet.Ansi)]
           60  +		public static extern
           61  +			void rhash_print(StringBuilder output, IntPtr ctx, uint hash_id, int flags);
           62  +
           63  +		[DllImport (librhash)]
           64  +		public static extern
           65  +			int rhash_print_magnet(StringBuilder output, String filepath, IntPtr ctx, uint hash_mask, int flags);
           66  +	}
           67  +}

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/bindings/mono/HashType.cs version [ad61b6f9a1].

            1  +/*
            2  + * This file is a part of Java Bindings for Librhash
            3  + * Copyright (c) 2011-2012, 2014, Sergey Basalaev <sbasalaev@gmail.com>
            4  + * Librhash is (c) 2011-2012, Aleksey Kravchenko <rhash.admin@gmail.com>
            5  + * 
            6  + * Permission is hereby granted, free of charge,  to any person obtaining a copy
            7  + * of this software and associated documentation files (the "Software"), to deal
            8  + * in the Software without restriction,  including without limitation the rights
            9  + * to  use,  copy,  modify,  merge, publish, distribute, sublicense, and/or sell
           10  + * copies  of  the Software,  and  to permit  persons  to whom  the Software  is
           11  + * furnished to do so.
           12  + * 
           13  + * This library  is distributed  in the hope that it will be useful, but WITHOUT
           14  + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
           15  + * FOR A PARTICULAR PURPOSE. Use it at your own risk!
           16  + */
           17  +
           18  +using System;
           19  +
           20  +namespace RHash {
           21  +	
           22  +	/*
           23  +	 * Type of hashing algorithm.
           24  +	 * Supported algorithms are MD4, MD5, SHA1/SHA2, Tiger,
           25  +	 * DC++ TTH, BitTorrent BTIH, AICH, EDonkey 2000 hash, GOST R 34.11-94,
           26  +	 * RIPEMD-160, HAS-160, EDON-R 256/512, Whirlpool and Snefru-128/256.
           27  +	 */
           28  +	public enum HashType : uint {
           29  +		/* CRC32 checksum. */
           30  +		CRC32 = 1,
           31  +		/* MD4 hash. */
           32  +		MD4 = 1 << 1,
           33  +		/* MD5 hash. */
           34  +		MD5 = 1 << 2,
           35  +		/* SHA-1 hash. */
           36  +		SHA1 = 1 << 3,
           37  +		/* Tiger hash. */
           38  +		TIGER = 1 << 4,
           39  +		/* Tiger tree hash */
           40  +		TTH = 1 << 5,
           41  +		/* BitTorrent info hash. */
           42  +		BTIH = 1 << 6,
           43  +		/* EDonkey 2000 hash. */
           44  +		ED2K = 1 << 7,
           45  +		/* eMule AICH. */
           46  +		AICH = 1 << 8,
           47  +		/* Whirlpool hash. */
           48  +		WHIRLPOOL = 1 << 9,
           49  +		/* RIPEMD-160 hash. */
           50  +		RIPEMD160 = 1 << 10,
           51  +		/* GOST R 34.11-94. */
           52  +		GOST = 1 << 11,
           53  +		GOST_CRYPTOPRO = 1 << 12,
           54  +		/* HAS-160 hash. */
           55  +		HAS160 = 1 << 13,
           56  +		/* Snefru-128 hash. */
           57  +		SNEFRU128 = 1 << 14,
           58  +		/* Snefru-256 hash. */
           59  +		SNEFRU256 = 1 << 15,
           60  +		/* SHA-224 hash. */
           61  +		SHA224 = 1 << 16,
           62  +		/* SHA-256 hash. */
           63  +		SHA256 = 1 << 17,
           64  +		/* SHA-384 hash. */
           65  +		SHA384 = 1 << 18,
           66  +		/* SHA-512 hash. */
           67  +		SHA512 = 1 << 19,
           68  +		/* EDON-R 256. */
           69  +		EDONR256 = 1 << 20,
           70  +		/* EDON-R 512. */
           71  +		EDONR512 = 1 << 21,
           72  +		/** SHA3-224 hash. */
           73  +		SHA3_224 = 1 << 22,
           74  +		/** SHA3-256 hash. */
           75  +		SHA3_256 = 1 << 23,
           76  +		/** SHA3-384 hash. */
           77  +		SHA3_384 = 1 << 24,
           78  +		/** SHA3-512 hash. */
           79  +		SHA3_512 = 1 << 25
           80  +	}
           81  +}

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/bindings/mono/Hasher.cs version [8f5502586e].

            1  +/*
            2  + * This file is a part of Java Bindings for Librhash
            3  + * Copyright (c) 2011-2012, Sergey Basalaev <sbasalaev@gmail.com>
            4  + * Librhash is (c) 2011-2012, Aleksey Kravchenko <rhash.admin@gmail.com>
            5  + * 
            6  + * Permission is hereby granted, free of charge,  to any person obtaining a copy
            7  + * of this software and associated documentation files (the "Software"), to deal
            8  + * in the Software without restriction,  including without limitation the rights
            9  + * to  use,  copy,  modify,  merge, publish, distribute, sublicense, and/or sell
           10  + * copies  of  the Software,  and  to permit  persons  to whom  the Software  is
           11  + * furnished to do so.
           12  + * 
           13  + * This library  is distributed  in the hope that it will be useful, but WITHOUT
           14  + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
           15  + * FOR A PARTICULAR PURPOSE. Use it at your own risk!
           16  + */
           17  +
           18  +using System;
           19  +using System.IO;
           20  +using System.Text;
           21  +
           22  +namespace RHash {
           23  +		
           24  +	public sealed class Hasher {
           25  +
           26  +		private const int DEFAULT   = 0x0;
           27  +		/* output as binary message digest */
           28  +		private const int RAW       = 0x1;
           29  +		/* print as a hexadecimal string */
           30  +		private const int HEX       = 0x2;
           31  +		/* print as a base32-encoded string */
           32  +		private const int BASE32    = 0x3;
           33  +		/* print as a base64-encoded string */
           34  +		private const int BASE64    = 0x4;
           35  +		/* Print as an uppercase string. */
           36  +		private const int UPPERCASE = 0x8;
           37  +		/* Reverse hash bytes. */
           38  +		private const int REVERSE   = 0x10;
           39  +		/* Print file size. */
           40  +		private const int FILESIZE  = 0x40;
           41  +		
           42  +		private uint hash_ids;
           43  +		/* Pointer to the native structure. */
           44  +		private IntPtr ptr;
           45  +		
           46  +		public Hasher (HashType hashtype) {
           47  +			this.hash_ids = (uint)hashtype;
           48  +			this.ptr = Bindings.rhash_init(hash_ids);
           49  +		}
           50  +		
           51  +		public Hasher (uint hashmask) {
           52  +			this.hash_ids = hashmask;
           53  +			this.ptr = Bindings.rhash_init(hash_ids);
           54  +			if (ptr == IntPtr.Zero) throw new ArgumentException("Invalid mask of hashes", "hashmask");
           55  +		}
           56  +		
           57  +		~Hasher() {
           58  +			if (ptr != IntPtr.Zero) {
           59  +				Bindings.rhash_free(ptr);
           60  +				ptr = IntPtr.Zero;
           61  +			}
           62  +		}
           63  +		
           64  +		public Hasher Update(byte[] buf) {
           65  +			Bindings.rhash_update(ptr, buf, buf.Length);
           66  +			return this;
           67  +		}
           68  +
           69  +		public Hasher Update(byte[] buf, int len) {
           70  +			if (len < 0 || len >= buf.Length) {
           71  +				throw new IndexOutOfRangeException();
           72  +			}
           73  +			Bindings.rhash_update(ptr, buf, len);
           74  +			return this;
           75  +		}
           76  +		
           77  +		public Hasher UpdateFile(string filename) {
           78  +			Stream file = new FileStream(filename, FileMode.Open);
           79  +			byte[] buf = new byte[8192];
           80  +			int len = file.Read(buf, 0, 8192);
           81  +			while (len > 0) {
           82  +				Bindings.rhash_update(ptr, buf, len);
           83  +				len = file.Read(buf, 0, 8192);
           84  +			}
           85  +			file.Close();
           86  +			return this;
           87  +		}
           88  +		
           89  +		public void Finish() {
           90  +			Bindings.rhash_final(ptr, IntPtr.Zero);
           91  +		}
           92  +		
           93  +		public void Reset() {
           94  +			Bindings.rhash_reset(ptr);
           95  +		}
           96  +		
           97  +		public override string ToString() {
           98  +			StringBuilder sb = new StringBuilder(130);
           99  +			Bindings.rhash_print(sb, ptr, 0, 0);
          100  +			return sb.ToString();
          101  +		}
          102  +		
          103  +		public string ToString(HashType type) {
          104  +			if ((hash_ids & (uint)type) == 0) {
          105  +				throw new ArgumentException("This hasher does not support hash type "+type, "type");
          106  +			}
          107  +			StringBuilder sb = new StringBuilder(130);
          108  +			Bindings.rhash_print(sb, ptr, (uint)type, 0);
          109  +			return sb.ToString();
          110  +		}
          111  +		
          112  +		public string ToHex(HashType type) {
          113  +			if ((hash_ids & (uint)type) == 0) {
          114  +				throw new ArgumentException("This hasher does not support hash type "+type, "type");
          115  +			}
          116  +			StringBuilder sb = new StringBuilder(130);
          117  +			Bindings.rhash_print(sb, ptr, (uint)type, HEX);
          118  +			return sb.ToString();
          119  +		}
          120  +
          121  +		public string ToBase32(HashType type) {
          122  +			if ((hash_ids & (uint)type) == 0) {
          123  +				throw new ArgumentException("This hasher does not support hash type "+type, "type");
          124  +			}
          125  +			StringBuilder sb = new StringBuilder(130);
          126  +			Bindings.rhash_print(sb, ptr, (uint)type, BASE32);
          127  +			return sb.ToString();
          128  +		}
          129  +
          130  +		public string ToBase64(HashType type) {
          131  +			if ((hash_ids & (uint)type) == 0) {
          132  +				throw new ArgumentException("This hasher does not support hash type "+type, "type");
          133  +			}
          134  +			StringBuilder sb = new StringBuilder(130);
          135  +			Bindings.rhash_print(sb, ptr, (uint)type, BASE32);
          136  +			return sb.ToString();
          137  +		}
          138  +
          139  +		public string ToRaw(HashType type) {
          140  +			if ((hash_ids & (uint)type) == 0) {
          141  +				throw new ArgumentException("This hasher does not support hash type "+type, "type");
          142  +			}
          143  +			StringBuilder sb = new StringBuilder(130);
          144  +			Bindings.rhash_print(sb, ptr, (uint)type, RAW);
          145  +			return sb.ToString();
          146  +		}
          147  +
          148  +		public string GetMagnet(string filepath) {
          149  +			return GetMagnet(filepath, hash_ids);
          150  +		}
          151  +
          152  +		public string GetMagnet(string filepath, uint hashmask) {
          153  +			int len = Bindings.rhash_print_magnet(null, filepath, ptr, hashmask, FILESIZE);
          154  +			StringBuilder sb = new StringBuilder(len);
          155  +			Bindings.rhash_print_magnet(sb, filepath, ptr, hashmask, FILESIZE);
          156  +			return sb.ToString();
          157  +		}
          158  +		
          159  +		public static string GetHashForMsg(byte[] buf, HashType type) {
          160  +			return new Hasher(type).Update(buf).ToString(type);
          161  +		}
          162  +		
          163  +		public static string GetHashForFile(string filename, HashType type) {
          164  +			return new Hasher(type).UpdateFile(filename).ToString(type);
          165  +		}
          166  +		
          167  +		public static string GetMagnetFor(string filepath, uint hashmask) {
          168  +			return new Hasher(hashmask).UpdateFile(filepath).GetMagnet(filepath);
          169  +		}
          170  +	}
          171  +}

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/bindings/mono/Makefile version [70b58100d6].

            1  +#!/usr/bin/make -f
            2  +
            3  +# This file is a part of Mono Bindings for Librhash
            4  +# Copyright (c) 2011-2012, Sergey Basalaev <sbasalaev@gmail.com>
            5  +# Librhash is (c) 2011-2012, Aleksey Kravchenko <rhash.admin@gmail.com>
            6  +# 
            7  +# Permission is hereby granted, free of charge,  to any person obtaining a copy
            8  +# of this software and associated documentation files (the "Software"), to deal
            9  +# in the Software without restriction,  including without limitation the rights
           10  +# to  use,  copy,  modify,  merge, publish, distribute, sublicense, and/or sell
           11  +# copies  of  the Software,  and  to permit  persons  to whom  the Software  is
           12  +# furnished to do so.
           13  +# 
           14  +# This library  is distributed  in the hope that it will be useful, but WITHOUT
           15  +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
           16  +# FOR A PARTICULAR PURPOSE. Use it at your own risk!
           17  +
           18  +CS?=mcs
           19  +MDOC?=mdoc
           20  +SOURCES=AssemblyInfo.cs Bindings.cs Hasher.cs HashType.cs
           21  +
           22  +all: assembly assemble-doc html
           23  +
           24  +assembly: RHash.dll RHash.dll.mdb
           25  +
           26  +RHash.dll RHash.dll.mdb: $(SOURCES)
           27  +	$(CS) -target:library -out:RHash.dll -debug -keyfile:RHash.snk $(SOURCES)
           28  +
           29  +update-doc: RHash.dll
           30  +	$(MDOC) update RHash.dll -o doc
           31  +
           32  +assemble-doc: RHash.tree RHash.zip
           33  +
           34  +RHash.tree RHash.zip:
           35  +	$(MDOC) assemble -o RHash doc
           36  +
           37  +html:
           38  +	$(MDOC) export-html -o html doc
           39  +
           40  +test: RHash.dll
           41  +	+$(MAKE) -C test
           42  +
           43  +clean:
           44  +	rm -f RHash.dll RHash.dll.mdb
           45  +	rm -f RHash.tree RHash.zip
           46  +	rm -rf html
           47  +	+$(MAKE) -C test clean
           48  +
           49  +.PHONY : clean html test

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/bindings/mono/RHash.csproj version [0178871b60].

            1  +<?xml version="1.0" encoding="utf-8"?>
            2  +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
            3  +  <PropertyGroup>
            4  +    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
            5  +    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
            6  +    <ProductVersion>10.0.0</ProductVersion>
            7  +    <SchemaVersion>2.0</SchemaVersion>
            8  +    <ProjectGuid>{2EC1635A-308E-46E4-B016-017C2AF3CDD9}</ProjectGuid>
            9  +    <OutputType>Library</OutputType>
           10  +    <RootNamespace>RHash</RootNamespace>
           11  +    <AssemblyName>RHash</AssemblyName>
           12  +    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
           13  +    <Description>.NET/Mono bindings for librhash</Description>
           14  +    <ReleaseVersion>1.0</ReleaseVersion>
           15  +  </PropertyGroup>
           16  +  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
           17  +    <DebugSymbols>true</DebugSymbols>
           18  +    <DebugType>full</DebugType>
           19  +    <Optimize>false</Optimize>
           20  +    <OutputPath>bin\Debug</OutputPath>
           21  +    <DefineConstants>DEBUG</DefineConstants>
           22  +    <ErrorReport>prompt</ErrorReport>
           23  +    <WarningLevel>4</WarningLevel>
           24  +    <ConsolePause>false</ConsolePause>
           25  +  </PropertyGroup>
           26  +  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
           27  +    <DebugType>none</DebugType>
           28  +    <Optimize>false</Optimize>
           29  +    <OutputPath>bin\Release</OutputPath>
           30  +    <ErrorReport>prompt</ErrorReport>
           31  +    <WarningLevel>4</WarningLevel>
           32  +    <ConsolePause>false</ConsolePause>
           33  +  </PropertyGroup>
           34  +  <ItemGroup>
           35  +    <Reference Include="System" />
           36  +  </ItemGroup>
           37  +  <ItemGroup>
           38  +    <Compile Include="AssemblyInfo.cs" />
           39  +    <Compile Include="HashType.cs" />
           40  +    <Compile Include="Bindings.cs" />
           41  +    <Compile Include="Hasher.cs" />
           42  +  </ItemGroup>
           43  +  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
           44  +</Project>

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/bindings/mono/RHash.dll.config version [0e7c0b0701].

            1  +<configuration>
            2  +        <dllmap dll="librhash.dll" os="!windows" target="librhash.so.0" />
            3  +        <dllmap dll="librhash.dll" os="osx" target="librhash.0.dylib" />
            4  +</configuration>

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/bindings/mono/RHash.sln version [2e1be7b949].

            1  +
            2  +Microsoft Visual Studio Solution File, Format Version 11.00
            3  +# Visual Studio 2010
            4  +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RHash", "RHash.csproj", "{2EC1635A-308E-46E4-B016-017C2AF3CDD9}"
            5  +EndProject
            6  +Global
            7  +	GlobalSection(SolutionConfigurationPlatforms) = preSolution
            8  +		Debug|Any CPU = Debug|Any CPU
            9  +		Release|Any CPU = Release|Any CPU
           10  +	EndGlobalSection
           11  +	GlobalSection(ProjectConfigurationPlatforms) = postSolution
           12  +		{2EC1635A-308E-46E4-B016-017C2AF3CDD9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
           13  +		{2EC1635A-308E-46E4-B016-017C2AF3CDD9}.Debug|Any CPU.Build.0 = Debug|Any CPU
           14  +		{2EC1635A-308E-46E4-B016-017C2AF3CDD9}.Release|Any CPU.ActiveCfg = Release|Any CPU
           15  +		{2EC1635A-308E-46E4-B016-017C2AF3CDD9}.Release|Any CPU.Build.0 = Release|Any CPU
           16  +	EndGlobalSection
           17  +	GlobalSection(MonoDevelopProperties) = preSolution
           18  +		StartupItem = RHash.csproj
           19  +		Policies = $0
           20  +		$0.DotNetNamingPolicy = $1
           21  +		$1.DirectoryNamespaceAssociation = None
           22  +		$1.ResourceNamePolicy = FileFormatDefault
           23  +		$0.StandardHeader = $2
           24  +		$2.Text = 
           25  +		$2.IncludeInNewFiles = True
           26  +		description = .NET/Mono bindings for librhash
           27  +		version = 1.0
           28  +	EndGlobalSection
           29  +EndGlobal

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/bindings/mono/RHash.snk version [e790e1daa3].

cannot compute difference between binary files

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/bindings/mono/doc/RHash/HashType.xml version [9e8ff363ec].

            1  +<Type Name="HashType" FullName="RHash.HashType">
            2  +  <TypeSignature Language="C#" Value="public enum HashType" />
            3  +  <TypeSignature Language="ILAsm" Value=".class public auto ansi sealed HashType extends System.Enum" />
            4  +  <AssemblyInfo>
            5  +    <AssemblyName>RHash</AssemblyName>
            6  +    <AssemblyVersion>1.0.1.1</AssemblyVersion>
            7  +  </AssemblyInfo>
            8  +  <Base>
            9  +    <BaseTypeName>System.Enum</BaseTypeName>
           10  +  </Base>
           11  +  <Docs>
           12  +    <summary>Type of hashing algorithm.</summary>
           13  +    <remarks>
           14  +      <para>
           15  +Supported algorithms are MD4, MD5, SHA1/SHA2, Tiger,
           16  +DC++ TTH, BitTorrent BTIH, AICH, EDonkey 2000 hash, GOST R 34.11-94,
           17  +RIPEMD-160, HAS-160, EDON-R 256/512, Whirlpool and Snefru-128/256.
           18  +</para>
           19  +      <para>
           20  +Constants may be OR-combined to form <see cref="T:System.UInt32" /> mask of hashes.
           21  +</para>
           22  +    </remarks>
           23  +  </Docs>
           24  +  <Members>
           25  +    <Member MemberName="AICH">
           26  +      <MemberSignature Language="C#" Value="AICH" />
           27  +      <MemberSignature Language="ILAsm" Value=".field public static literal valuetype RHash.HashType AICH = unsigned int32(256)" />
           28  +      <MemberType>Field</MemberType>
           29  +      <AssemblyInfo>
           30  +        <AssemblyVersion>1.0.1.1</AssemblyVersion>
           31  +      </AssemblyInfo>
           32  +      <ReturnValue>
           33  +        <ReturnType>RHash.HashType</ReturnType>
           34  +      </ReturnValue>
           35  +      <Docs>
           36  +        <summary>eMule AICH.</summary>
           37  +      </Docs>
           38  +    </Member>
           39  +    <Member MemberName="BTIH">
           40  +      <MemberSignature Language="C#" Value="BTIH" />
           41  +      <MemberSignature Language="ILAsm" Value=".field public static literal valuetype RHash.HashType BTIH = unsigned int32(64)" />
           42  +      <MemberType>Field</MemberType>
           43  +      <AssemblyInfo>
           44  +        <AssemblyVersion>1.0.1.1</AssemblyVersion>
           45  +      </AssemblyInfo>
           46  +      <ReturnValue>
           47  +        <ReturnType>RHash.HashType</ReturnType>
           48  +      </ReturnValue>
           49  +      <Docs>
           50  +        <summary>BitTorrent info hash.</summary>
           51  +      </Docs>
           52  +    </Member>
           53  +    <Member MemberName="CRC32">
           54  +      <MemberSignature Language="C#" Value="CRC32" />
           55  +      <MemberSignature Language="ILAsm" Value=".field public static literal valuetype RHash.HashType CRC32 = unsigned int32(1)" />
           56  +      <MemberType>Field</MemberType>
           57  +      <AssemblyInfo>
           58  +        <AssemblyVersion>1.0.1.1</AssemblyVersion>
           59  +      </AssemblyInfo>
           60  +      <ReturnValue>
           61  +        <ReturnType>RHash.HashType</ReturnType>
           62  +      </ReturnValue>
           63  +      <Docs>
           64  +        <summary>CRC32 checksum.</summary>
           65  +      </Docs>
           66  +    </Member>
           67  +    <Member MemberName="ED2K">
           68  +      <MemberSignature Language="C#" Value="ED2K" />
           69  +      <MemberSignature Language="ILAsm" Value=".field public static literal valuetype RHash.HashType ED2K = unsigned int32(128)" />
           70  +      <MemberType>Field</MemberType>
           71  +      <AssemblyInfo>
           72  +        <AssemblyVersion>1.0.1.1</AssemblyVersion>
           73  +      </AssemblyInfo>
           74  +      <ReturnValue>
           75  +        <ReturnType>RHash.HashType</ReturnType>
           76  +      </ReturnValue>
           77  +      <Docs>
           78  +        <summary>EDonkey 2000 hash.</summary>
           79  +      </Docs>
           80  +    </Member>
           81  +    <Member MemberName="EDONR256">
           82  +      <MemberSignature Language="C#" Value="EDONR256" />
           83  +      <MemberSignature Language="ILAsm" Value=".field public static literal valuetype RHash.HashType EDONR256 = unsigned int32(1048576)" />
           84  +      <MemberType>Field</MemberType>
           85  +      <AssemblyInfo>
           86  +        <AssemblyVersion>1.0.1.1</AssemblyVersion>
           87  +      </AssemblyInfo>
           88  +      <ReturnValue>
           89  +        <ReturnType>RHash.HashType</ReturnType>
           90  +      </ReturnValue>
           91  +      <Docs>
           92  +        <summary>EDON-R 256.</summary>
           93  +      </Docs>
           94  +    </Member>
           95  +    <Member MemberName="EDONR512">
           96  +      <MemberSignature Language="C#" Value="EDONR512" />
           97  +      <MemberSignature Language="ILAsm" Value=".field public static literal valuetype RHash.HashType EDONR512 = unsigned int32(2097152)" />
           98  +      <MemberType>Field</MemberType>
           99  +      <AssemblyInfo>
          100  +        <AssemblyVersion>1.0.1.1</AssemblyVersion>
          101  +      </AssemblyInfo>
          102  +      <ReturnValue>
          103  +        <ReturnType>RHash.HashType</ReturnType>
          104  +      </ReturnValue>
          105  +      <Docs>
          106  +        <summary>EDON-R 512.</summary>
          107  +      </Docs>
          108  +    </Member>
          109  +    <Member MemberName="GOST">
          110  +      <MemberSignature Language="C#" Value="GOST" />
          111  +      <MemberSignature Language="ILAsm" Value=".field public static literal valuetype RHash.HashType GOST = unsigned int32(2048)" />
          112  +      <MemberType>Field</MemberType>
          113  +      <AssemblyInfo>
          114  +        <AssemblyVersion>1.0.1.1</AssemblyVersion>
          115  +      </AssemblyInfo>
          116  +      <ReturnValue>
          117  +        <ReturnType>RHash.HashType</ReturnType>
          118  +      </ReturnValue>
          119  +      <Docs>
          120  +        <summary>GOST R 34.11-94.</summary>
          121  +      </Docs>
          122  +    </Member>
          123  +    <Member MemberName="GOST_CRYPTOPRO">
          124  +      <MemberSignature Language="C#" Value="GOST_CRYPTOPRO" />
          125  +      <MemberSignature Language="ILAsm" Value=".field public static literal valuetype RHash.HashType GOST_CRYPTOPRO = unsigned int32(4096)" />
          126  +      <MemberType>Field</MemberType>
          127  +      <AssemblyInfo>
          128  +        <AssemblyVersion>1.0.1.1</AssemblyVersion>
          129  +      </AssemblyInfo>
          130  +      <ReturnValue>
          131  +        <ReturnType>RHash.HashType</ReturnType>
          132  +      </ReturnValue>
          133  +      <Docs>
          134  +        <summary>GOST R 34.11-94, CryptoPro version.</summary>
          135  +      </Docs>
          136  +    </Member>
          137  +    <Member MemberName="HAS160">
          138  +      <MemberSignature Language="C#" Value="HAS160" />
          139  +      <MemberSignature Language="ILAsm" Value=".field public static literal valuetype RHash.HashType HAS160 = unsigned int32(8192)" />
          140  +      <MemberType>Field</MemberType>
          141  +      <AssemblyInfo>
          142  +        <AssemblyVersion>1.0.1.1</AssemblyVersion>
          143  +      </AssemblyInfo>
          144  +      <ReturnValue>
          145  +        <ReturnType>RHash.HashType</ReturnType>
          146  +      </ReturnValue>
          147  +      <Docs>
          148  +        <summary>HAS-160 hash.</summary>
          149  +      </Docs>
          150  +    </Member>
          151  +    <Member MemberName="MD4">
          152  +      <MemberSignature Language="C#" Value="MD4" />
          153  +      <MemberSignature Language="ILAsm" Value=".field public static literal valuetype RHash.HashType MD4 = unsigned int32(2)" />
          154  +      <MemberType>Field</MemberType>
          155  +      <AssemblyInfo>
          156  +        <AssemblyVersion>1.0.1.1</AssemblyVersion>
          157  +      </AssemblyInfo>
          158  +      <ReturnValue>
          159  +        <ReturnType>RHash.HashType</ReturnType>
          160  +      </ReturnValue>
          161  +      <Docs>
          162  +        <summary>MD4 hash.</summary>
          163  +      </Docs>
          164  +    </Member>
          165  +    <Member MemberName="MD5">
          166  +      <MemberSignature Language="C#" Value="MD5" />
          167  +      <MemberSignature Language="ILAsm" Value=".field public static literal valuetype RHash.HashType MD5 = unsigned int32(4)" />
          168  +      <MemberType>Field</MemberType>
          169  +      <AssemblyInfo>
          170  +        <AssemblyVersion>1.0.1.1</AssemblyVersion>
          171  +      </AssemblyInfo>
          172  +      <ReturnValue>
          173  +        <ReturnType>RHash.HashType</ReturnType>
          174  +      </ReturnValue>
          175  +      <Docs>
          176  +        <summary>MD5 hash.</summary>
          177  +      </Docs>
          178  +    </Member>
          179  +    <Member MemberName="RIPEMD160">
          180  +      <MemberSignature Language="C#" Value="RIPEMD160" />
          181  +      <MemberSignature Language="ILAsm" Value=".field public static literal valuetype RHash.HashType RIPEMD160 = unsigned int32(1024)" />
          182  +      <MemberType>Field</MemberType>
          183  +      <AssemblyInfo>
          184  +        <AssemblyVersion>1.0.1.1</AssemblyVersion>
          185  +      </AssemblyInfo>
          186  +      <ReturnValue>
          187  +        <ReturnType>RHash.HashType</ReturnType>
          188  +      </ReturnValue>
          189  +      <Docs>
          190  +        <summary>RIPEMD-160 hash.</summary>
          191  +      </Docs>
          192  +    </Member>
          193  +    <Member MemberName="SHA1">
          194  +      <MemberSignature Language="C#" Value="SHA1" />
          195  +      <MemberSignature Language="ILAsm" Value=".field public static literal valuetype RHash.HashType SHA1 = unsigned int32(8)" />
          196  +      <MemberType>Field</MemberType>
          197  +      <AssemblyInfo>
          198  +        <AssemblyVersion>1.0.1.1</AssemblyVersion>
          199  +      </AssemblyInfo>
          200  +      <ReturnValue>
          201  +        <ReturnType>RHash.HashType</ReturnType>
          202  +      </ReturnValue>
          203  +      <Docs>
          204  +        <summary>SHA-1 hash.</summary>
          205  +      </Docs>
          206  +    </Member>
          207  +    <Member MemberName="SHA224">
          208  +      <MemberSignature Language="C#" Value="SHA224" />
          209  +      <MemberSignature Language="ILAsm" Value=".field public static literal valuetype RHash.HashType SHA224 = unsigned int32(65536)" />
          210  +      <MemberType>Field</MemberType>
          211  +      <AssemblyInfo>
          212  +        <AssemblyVersion>1.0.1.1</AssemblyVersion>
          213  +      </AssemblyInfo>
          214  +      <ReturnValue>
          215  +        <ReturnType>RHash.HashType</ReturnType>
          216  +      </ReturnValue>
          217  +      <Docs>
          218  +        <summary>SHA-224 hash.</summary>
          219  +      </Docs>
          220  +    </Member>
          221  +    <Member MemberName="SHA256">
          222  +      <MemberSignature Language="C#" Value="SHA256" />
          223  +      <MemberSignature Language="ILAsm" Value=".field public static literal valuetype RHash.HashType SHA256 = unsigned int32(131072)" />
          224  +      <MemberType>Field</MemberType>
          225  +      <AssemblyInfo>
          226  +        <AssemblyVersion>1.0.1.1</AssemblyVersion>
          227  +      </AssemblyInfo>
          228  +      <ReturnValue>
          229  +        <ReturnType>RHash.HashType</ReturnType>
          230  +      </ReturnValue>
          231  +      <Docs>
          232  +        <summary>SHA-256 hash.</summary>
          233  +      </Docs>
          234  +    </Member>
          235  +    <Member MemberName="SHA3_224">
          236  +      <MemberSignature Language="C#" Value="SHA3_224" />
          237  +      <MemberSignature Language="ILAsm" Value=".field public static literal valuetype RHash.HashType SHA3_224 = unsigned int32(4194304)" />
          238  +      <MemberType>Field</MemberType>
          239  +      <AssemblyInfo>
          240  +        <AssemblyVersion>1.0.1.1</AssemblyVersion>
          241  +      </AssemblyInfo>
          242  +      <ReturnValue>
          243  +        <ReturnType>RHash.HashType</ReturnType>
          244  +      </ReturnValue>
          245  +      <Docs>
          246  +        <summary>SHA3-224 hash.</summary>
          247  +      </Docs>
          248  +    </Member>
          249  +    <Member MemberName="SHA3_256">
          250  +      <MemberSignature Language="C#" Value="SHA3_256" />
          251  +      <MemberSignature Language="ILAsm" Value=".field public static literal valuetype RHash.HashType SHA3_256 = unsigned int32(8388608)" />
          252  +      <MemberType>Field</MemberType>
          253  +      <AssemblyInfo>
          254  +        <AssemblyVersion>1.0.1.1</AssemblyVersion>
          255  +      </AssemblyInfo>
          256  +      <ReturnValue>
          257  +        <ReturnType>RHash.HashType</ReturnType>
          258  +      </ReturnValue>
          259  +      <Docs>
          260  +        <summary>SHA3-256 hash.</summary>
          261  +      </Docs>
          262  +    </Member>
          263  +    <Member MemberName="SHA3_384">
          264  +      <MemberSignature Language="C#" Value="SHA3_384" />
          265  +      <MemberSignature Language="ILAsm" Value=".field public static literal valuetype RHash.HashType SHA3_384 = unsigned int32(16777216)" />
          266  +      <MemberType>Field</MemberType>
          267  +      <AssemblyInfo>
          268  +        <AssemblyVersion>1.0.1.1</AssemblyVersion>
          269  +      </AssemblyInfo>
          270  +      <ReturnValue>
          271  +        <ReturnType>RHash.HashType</ReturnType>
          272  +      </ReturnValue>
          273  +      <Docs>
          274  +        <summary>SHA3-384 hash.</summary>
          275  +      </Docs>
          276  +    </Member>
          277  +    <Member MemberName="SHA3_512">
          278  +      <MemberSignature Language="C#" Value="SHA3_512" />
          279  +      <MemberSignature Language="ILAsm" Value=".field public static literal valuetype RHash.HashType SHA3_512 = unsigned int32(33554432)" />
          280  +      <MemberType>Field</MemberType>
          281  +      <AssemblyInfo>
          282  +        <AssemblyVersion>1.0.1.1</AssemblyVersion>
          283  +      </AssemblyInfo>
          284  +      <ReturnValue>
          285  +        <ReturnType>RHash.HashType</ReturnType>
          286  +      </ReturnValue>
          287  +      <Docs>
          288  +        <summary>SHA3-512 hash.</summary>
          289  +      </Docs>
          290  +    </Member>
          291  +    <Member MemberName="SHA384">
          292  +      <MemberSignature Language="C#" Value="SHA384" />
          293  +      <MemberSignature Language="ILAsm" Value=".field public static literal valuetype RHash.HashType SHA384 = unsigned int32(262144)" />
          294  +      <MemberType>Field</MemberType>
          295  +      <AssemblyInfo>
          296  +        <AssemblyVersion>1.0.1.1</AssemblyVersion>
          297  +      </AssemblyInfo>
          298  +      <ReturnValue>
          299  +        <ReturnType>RHash.HashType</ReturnType>
          300  +      </ReturnValue>
          301  +      <Docs>
          302  +        <summary>SHA-384 hash.</summary>
          303  +      </Docs>
          304  +    </Member>
          305  +    <Member MemberName="SHA512">
          306  +      <MemberSignature Language="C#" Value="SHA512" />
          307  +      <MemberSignature Language="ILAsm" Value=".field public static literal valuetype RHash.HashType SHA512 = unsigned int32(524288)" />
          308  +      <MemberType>Field</MemberType>
          309  +      <AssemblyInfo>
          310  +        <AssemblyVersion>1.0.1.1</AssemblyVersion>
          311  +      </AssemblyInfo>
          312  +      <ReturnValue>
          313  +        <ReturnType>RHash.HashType</ReturnType>
          314  +      </ReturnValue>
          315  +      <Docs>
          316  +        <summary>SHA-512 hash.</summary>
          317  +      </Docs>
          318  +    </Member>
          319  +    <Member MemberName="SNEFRU128">
          320  +      <MemberSignature Language="C#" Value="SNEFRU128" />
          321  +      <MemberSignature Language="ILAsm" Value=".field public static literal valuetype RHash.HashType SNEFRU128 = unsigned int32(16384)" />
          322  +      <MemberType>Field</MemberType>
          323  +      <AssemblyInfo>
          324  +        <AssemblyVersion>1.0.1.1</AssemblyVersion>
          325  +      </AssemblyInfo>
          326  +      <ReturnValue>
          327  +        <ReturnType>RHash.HashType</ReturnType>
          328  +      </ReturnValue>
          329  +      <Docs>
          330  +        <summary>Snefru-128 hash.</summary>
          331  +      </Docs>
          332  +    </Member>
          333  +    <Member MemberName="SNEFRU256">
          334  +      <MemberSignature Language="C#" Value="SNEFRU256" />
          335  +      <MemberSignature Language="ILAsm" Value=".field public static literal valuetype RHash.HashType SNEFRU256 = unsigned int32(32768)" />
          336  +      <MemberType>Field</MemberType>
          337  +      <AssemblyInfo>
          338  +        <AssemblyVersion>1.0.1.1</AssemblyVersion>
          339  +      </AssemblyInfo>
          340  +      <ReturnValue>
          341  +        <ReturnType>RHash.HashType</ReturnType>
          342  +      </ReturnValue>
          343  +      <Docs>
          344  +        <summary>Snefru-256 hash.</summary>
          345  +      </Docs>
          346  +    </Member>
          347  +    <Member MemberName="TIGER">
          348  +      <MemberSignature Language="C#" Value="TIGER" />
          349  +      <MemberSignature Language="ILAsm" Value=".field public static literal valuetype RHash.HashType TIGER = unsigned int32(16)" />
          350  +      <MemberType>Field</MemberType>
          351  +      <AssemblyInfo>
          352  +        <AssemblyVersion>1.0.1.1</AssemblyVersion>
          353  +      </AssemblyInfo>
          354  +      <ReturnValue>
          355  +        <ReturnType>RHash.HashType</ReturnType>
          356  +      </ReturnValue>
          357  +      <Docs>
          358  +        <summary>Tiger hash.</summary>
          359  +      </Docs>
          360  +    </Member>
          361  +    <Member MemberName="TTH">
          362  +      <MemberSignature Language="C#" Value="TTH" />
          363  +      <MemberSignature Language="ILAsm" Value=".field public static literal valuetype RHash.HashType TTH = unsigned int32(32)" />
          364  +      <MemberType>Field</MemberType>
          365  +      <AssemblyInfo>
          366  +        <AssemblyVersion>1.0.1.1</AssemblyVersion>
          367  +      </AssemblyInfo>
          368  +      <ReturnValue>
          369  +        <ReturnType>RHash.HashType</ReturnType>
          370  +      </ReturnValue>
          371  +      <Docs>
          372  +        <summary>Tiger tree hash.</summary>
          373  +      </Docs>
          374  +    </Member>
          375  +    <Member MemberName="WHIRLPOOL">
          376  +      <MemberSignature Language="C#" Value="WHIRLPOOL" />
          377  +      <MemberSignature Language="ILAsm" Value=".field public static literal valuetype RHash.HashType WHIRLPOOL = unsigned int32(512)" />
          378  +      <MemberType>Field</MemberType>
          379  +      <AssemblyInfo>
          380  +        <AssemblyVersion>1.0.1.1</AssemblyVersion>
          381  +      </AssemblyInfo>
          382  +      <ReturnValue>
          383  +        <ReturnType>RHash.HashType</ReturnType>
          384  +      </ReturnValue>
          385  +      <Docs>
          386  +        <summary>Whirlpool hash.</summary>
          387  +      </Docs>
          388  +    </Member>
          389  +  </Members>
          390  +</Type>

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/bindings/mono/doc/RHash/Hasher.xml version [3d1f373212].

            1  +<Type Name="Hasher" FullName="RHash.Hasher">
            2  +  <TypeSignature Language="C#" Value="public sealed class Hasher" />
            3  +  <TypeSignature Language="ILAsm" Value=".class public auto ansi sealed beforefieldinit Hasher extends System.Object" />
            4  +  <AssemblyInfo>
            5  +    <AssemblyName>RHash</AssemblyName>
            6  +    <AssemblyVersion>1.0.1.1</AssemblyVersion>
            7  +  </AssemblyInfo>
            8  +  <Base>
            9  +    <BaseTypeName>System.Object</BaseTypeName>
           10  +  </Base>
           11  +  <Interfaces />
           12  +  <Docs>
           13  +    <summary>Incremental hasher.</summary>
           14  +    <remarks>This class allows you to do incremental hashing for set of hashing algorithms.</remarks>
           15  +  </Docs>
           16  +  <Members>
           17  +    <Member MemberName=".ctor">
           18  +      <MemberSignature Language="C#" Value="public Hasher (RHash.HashType hashtype);" />
           19  +      <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(valuetype RHash.HashType hashtype) cil managed" />
           20  +      <MemberType>Constructor</MemberType>
           21  +      <AssemblyInfo>
           22  +        <AssemblyVersion>1.0.1.1</AssemblyVersion>
           23  +      </AssemblyInfo>
           24  +      <Parameters>
           25  +        <Parameter Name="hashtype" Type="RHash.HashType" />
           26  +      </Parameters>
           27  +      <Docs>
           28  +        <param name="hashtype">Type of hashing algorithm.</param>
           29  +        <summary>Creates new Hasher to compute message digest for given type.</summary>
           30  +        <remarks>To be added.</remarks>
           31  +      </Docs>
           32  +    </Member>
           33  +    <Member MemberName=".ctor">
           34  +      <MemberSignature Language="C#" Value="public Hasher (uint hashmask);" />
           35  +      <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(unsigned int32 hashmask) cil managed" />
           36  +      <MemberType>Constructor</MemberType>
           37  +      <AssemblyInfo>
           38  +        <AssemblyVersion>1.0.1.1</AssemblyVersion>
           39  +      </AssemblyInfo>
           40  +      <Parameters>
           41  +        <Parameter Name="hashmask" Type="System.UInt32" />
           42  +      </Parameters>
           43  +      <Docs>
           44  +        <param name="hashmask">Mask created of one or more <see cref="T:RHash.HashType" /> values.</param>
           45  +        <summary>Creates new Hasher to compute message digests for given set of hashing algorithms.</summary>
           46  +        <remarks>Mask should be created from ORed HashType values. The next example will create Hasher that computes both CRC32 and MD5 sums:
           47  +
           48  +<example><code lang="C#">
           49  +  new Hasher((uint)HashType.CRC32 | (uint)HashType.MD5);</code></example></remarks>
           50  +        <exception cref="T:System.ArgumentException">Argument is zero or contains invalid bits.</exception>
           51  +      </Docs>
           52  +    </Member>
           53  +    <Member MemberName="Finalize">
           54  +      <MemberSignature Language="C#" Value="~Hasher ();" />
           55  +      <MemberSignature Language="ILAsm" Value=".method familyhidebysig virtual instance void Finalize() cil managed" />
           56  +      <MemberType>Method</MemberType>
           57  +      <AssemblyInfo>
           58  +        <AssemblyVersion>1.0.1.1</AssemblyVersion>
           59  +      </AssemblyInfo>
           60  +      <ReturnValue>
           61  +        <ReturnType>System.Void</ReturnType>
           62  +      </ReturnValue>
           63  +      <Parameters />
           64  +      <Docs>
           65  +        <summary>Called by garbage collector to free native resources.</summary>
           66  +        <remarks>To be added.</remarks>
           67  +      </Docs>
           68  +    </Member>
           69  +    <Member MemberName="Finish">
           70  +      <MemberSignature Language="C#" Value="public void Finish ();" />
           71  +      <MemberSignature Language="ILAsm" Value=".method public hidebysig instance void Finish() cil managed" />
           72  +      <MemberType>Method</MemberType>
           73  +      <AssemblyInfo>
           74  +        <AssemblyVersion>1.0.1.1</AssemblyVersion>
           75  +      </AssemblyInfo>
           76  +      <ReturnValue>
           77  +        <ReturnType>System.Void</ReturnType>
           78  +      </ReturnValue>
           79  +      <Parameters />
           80  +      <Docs>
           81  +        <summary>Finishes calculation of hashes.</summary>
           82  +        <remarks>Processes any buffered data and finishes computation of hash sums.</remarks>
           83  +      </Docs>
           84  +    </Member>
           85  +    <Member MemberName="GetHashForFile">
           86  +      <MemberSignature Language="C#" Value="public static string GetHashForFile (string filename, RHash.HashType type);" />
           87  +      <MemberSignature Language="ILAsm" Value=".method public static hidebysig string GetHashForFile(string filename, valuetype RHash.HashType type) cil managed" />
           88  +      <MemberType>Method</MemberType>
           89  +      <AssemblyInfo>
           90  +        <AssemblyVersion>1.0.1.1</AssemblyVersion>
           91  +      </AssemblyInfo>
           92  +      <ReturnValue>
           93  +        <ReturnType>System.String</ReturnType>
           94  +      </ReturnValue>
           95  +      <Parameters>
           96  +        <Parameter Name="filename" Type="System.String" />
           97  +        <Parameter Name="type" Type="RHash.HashType" />
           98  +      </Parameters>
           99  +      <Docs>
          100  +        <param name="filename">File to compute hash for.</param>
          101  +        <param name="type">Type of hash to compute.</param>
          102  +        <summary>Computes message digest for given file.</summary>
          103  +        <returns>Message digest as returned by <see cref="M:RHash.Hasher.ToString(RHash.HashType)" />.</returns>
          104  +        <remarks>To be added.</remarks>
          105  +      </Docs>
          106  +    </Member>
          107  +    <Member MemberName="GetHashForMsg">
          108  +      <MemberSignature Language="C#" Value="public static string GetHashForMsg (byte[] buf, RHash.HashType type);" />
          109  +      <MemberSignature Language="ILAsm" Value=".method public static hidebysig string GetHashForMsg(unsigned int8[] buf, valuetype RHash.HashType type) cil managed" />
          110  +      <MemberType>Method</MemberType>
          111  +      <AssemblyInfo>
          112  +        <AssemblyVersion>1.0.1.1</AssemblyVersion>
          113  +      </AssemblyInfo>
          114  +      <ReturnValue>
          115  +        <ReturnType>System.String</ReturnType>
          116  +      </ReturnValue>
          117  +      <Parameters>
          118  +        <Parameter Name="buf" Type="System.Byte[]" />
          119  +        <Parameter Name="type" Type="RHash.HashType" />
          120  +      </Parameters>
          121  +      <Docs>
          122  +        <param name="buf">Binary message to compute hash for.</param>
          123  +        <param name="type">Type of hash to compute.</param>
          124  +        <summary>Computes message digest for given binary message.</summary>
          125  +        <returns>Message digest, as returned by <see cref="M:RHash.Hasher.ToString(RHash.HashType)" />.</returns>
          126  +        <remarks>To be added.</remarks>
          127  +      </Docs>
          128  +    </Member>
          129  +    <Member MemberName="GetMagnet">
          130  +      <MemberSignature Language="C#" Value="public string GetMagnet (string filepath);" />
          131  +      <MemberSignature Language="ILAsm" Value=".method public hidebysig instance string GetMagnet(string filepath) cil managed" />
          132  +      <MemberType>Method</MemberType>
          133  +      <AssemblyInfo>
          134  +        <AssemblyVersion>1.0.1.1</AssemblyVersion>
          135  +      </AssemblyInfo>
          136  +      <ReturnValue>
          137  +        <ReturnType>System.String</ReturnType>
          138  +      </ReturnValue>
          139  +      <Parameters>
          140  +        <Parameter Name="filepath" Type="System.String" />
          141  +      </Parameters>
          142  +      <Docs>
          143  +        <param name="filepath">File path to be included in magnet. May be null.</param>
          144  +        <summary>Generates magnet link with given filename.</summary>
          145  +        <returns>Magnet link.</returns>
          146  +        <remarks>Magnet includes all hashes computed by this hasher. If filepath is null then returned magnet does not contain a filename.</remarks>
          147  +      </Docs>
          148  +    </Member>
          149  +    <Member MemberName="GetMagnet">
          150  +      <MemberSignature Language="C#" Value="public string GetMagnet (string filepath, uint hashmask);" />
          151  +      <MemberSignature Language="ILAsm" Value=".method public hidebysig instance string GetMagnet(string filepath, unsigned int32 hashmask) cil managed" />
          152  +      <MemberType>Method</MemberType>
          153  +      <AssemblyInfo>
          154  +        <AssemblyVersion>1.0.1.1</AssemblyVersion>
          155  +      </AssemblyInfo>
          156  +      <ReturnValue>
          157  +        <ReturnType>System.String</ReturnType>
          158  +      </ReturnValue>
          159  +      <Parameters>
          160  +        <Parameter Name="filepath" Type="System.String" />
          161  +        <Parameter Name="hashmask" Type="System.UInt32" />
          162  +      </Parameters>
          163  +      <Docs>
          164  +        <param name="filepath">File path to be included in magnet. May be null.</param>
          165  +        <param name="hashmask">Mask created from one or more <see cref="T:RHash.HashType" /> values.</param>
          166  +        <summary>Generates magnet link with given filename and hashes.</summary>
          167  +        <returns>Magnet link.</returns>
          168  +        <remarks>Only hashes that were computed by this Hasher are included in the output. If filepath is null then returned magnet does not contain a filename.</remarks>
          169  +      </Docs>
          170  +    </Member>
          171  +    <Member MemberName="GetMagnetFor">
          172  +      <MemberSignature Language="C#" Value="public static string GetMagnetFor (string filepath, uint hashmask);" />
          173  +      <MemberSignature Language="ILAsm" Value=".method public static hidebysig string GetMagnetFor(string filepath, unsigned int32 hashmask) cil managed" />
          174  +      <MemberType>Method</MemberType>
          175  +      <AssemblyInfo>
          176  +        <AssemblyVersion>1.0.1.1</AssemblyVersion>
          177  +      </AssemblyInfo>
          178  +      <ReturnValue>
          179  +        <ReturnType>System.String</ReturnType>
          180  +      </ReturnValue>
          181  +      <Parameters>
          182  +        <Parameter Name="filepath" Type="System.String" />
          183  +        <Parameter Name="hashmask" Type="System.UInt32" />
          184  +      </Parameters>
          185  +      <Docs>
          186  +        <param name="filepath">File to process.</param>
          187  +        <param name="hashmask">Mask created of one or more <see cref="T:RHash.HashType" /> values.</param>
          188  +        <summary>Generates magnet for specified file with given hashes.</summary>
          189  +        <returns>Magnet link.</returns>
          190  +        <remarks>Returned magnet includes file name and all computed hashes.</remarks>
          191  +      </Docs>
          192  +    </Member>
          193  +    <Member MemberName="Reset">
          194  +      <MemberSignature Language="C#" Value="public void Reset ();" />
          195  +      <MemberSignature Language="ILAsm" Value=".method public hidebysig instance void Reset() cil managed" />
          196  +      <MemberType>Method</MemberType>
          197  +      <AssemblyInfo>
          198  +        <AssemblyVersion>1.0.1.1</AssemblyVersion>
          199  +      </AssemblyInfo>
          200  +      <ReturnValue>
          201  +        <ReturnType>System.Void</ReturnType>
          202  +      </ReturnValue>
          203  +      <Parameters />
          204  +      <Docs>
          205  +        <summary>Resets this Hasher to initial state.</summary>
          206  +        <remarks>The Hasher becomes available to process new data chunks.
          207  +Note, that this method returns Hasher to the state after creating
          208  +the object, NOT the state when hashing continues.
          209  +Therefore, all previously calculated hashes are lost
          210  +and process starts from the very beginning.</remarks>
          211  +      </Docs>
          212  +    </Member>
          213  +    <Member MemberName="ToBase32">
          214  +      <MemberSignature Language="C#" Value="public string ToBase32 (RHash.HashType type);" />
          215  +      <MemberSignature Language="ILAsm" Value=".method public hidebysig instance string ToBase32(valuetype RHash.HashType type) cil managed" />
          216  +      <MemberType>Method</MemberType>
          217  +      <AssemblyInfo>
          218  +        <AssemblyVersion>1.0.1.1</AssemblyVersion>
          219  +      </AssemblyInfo>
          220  +      <ReturnValue>
          221  +        <ReturnType>System.String</ReturnType>
          222  +      </ReturnValue>
          223  +      <Parameters>
          224  +        <Parameter Name="type" Type="RHash.HashType" />
          225  +      </Parameters>
          226  +      <Docs>
          227  +        <param name="type">Type of hashing algorithm.</param>
          228  +        <summary>Returns value of computed digest as base32 string.</summary>
          229  +        <returns>Message digest in form of base32 string.</returns>
          230  +        <remarks>To be added.</remarks>
          231  +        <exception cref="T:System.ArgumentException">This Hasher does not compute hash of given type.</exception>
          232  +      </Docs>
          233  +    </Member>
          234  +    <Member MemberName="ToBase64">
          235  +      <MemberSignature Language="C#" Value="public string ToBase64 (RHash.HashType type);" />
          236  +      <MemberSignature Language="ILAsm" Value=".method public hidebysig instance string ToBase64(valuetype RHash.HashType type) cil managed" />
          237  +      <MemberType>Method</MemberType>
          238  +      <AssemblyInfo>
          239  +        <AssemblyVersion>1.0.1.1</AssemblyVersion>
          240  +      </AssemblyInfo>
          241  +      <ReturnValue>
          242  +        <ReturnType>System.String</ReturnType>
          243  +      </ReturnValue>
          244  +      <Parameters>
          245  +        <Parameter Name="type" Type="RHash.HashType" />
          246  +      </Parameters>
          247  +      <Docs>
          248  +        <param name="type">Type of hashing algorithm.</param>
          249  +        <summary>Returns value of computed digest as base64 string.</summary>
          250  +        <returns>Message digest in form of base64 string.</returns>
          251  +        <remarks>To be added.</remarks>
          252  +        <exception cref="T:System.ArgumentException">This Hasher does not compute hash of given type.</exception>
          253  +      </Docs>
          254  +    </Member>
          255  +    <Member MemberName="ToHex">
          256  +      <MemberSignature Language="C#" Value="public string ToHex (RHash.HashType type);" />
          257  +      <MemberSignature Language="ILAsm" Value=".method public hidebysig instance string ToHex(valuetype RHash.HashType type) cil managed" />
          258  +      <MemberType>Method</MemberType>
          259  +      <AssemblyInfo>
          260  +        <AssemblyVersion>1.0.1.1</AssemblyVersion>
          261  +      </AssemblyInfo>
          262  +      <ReturnValue>
          263  +        <ReturnType>System.String</ReturnType>
          264  +      </ReturnValue>
          265  +      <Parameters>
          266  +        <Parameter Name="type" Type="RHash.HashType" />
          267  +      </Parameters>
          268  +      <Docs>
          269  +        <param name="type">Type of hashing algorithm.</param>
          270  +        <summary>Returns value of computed digest as hexadecimal string.</summary>
          271  +        <returns>Message digest in form of hexadecimal string.</returns>
          272  +        <remarks>To be added.</remarks>
          273  +        <exception cref="T:System.ArgumentException">This Hasher does not compute hash of given type.</exception>
          274  +      </Docs>
          275  +    </Member>
          276  +    <Member MemberName="ToRaw">
          277  +      <MemberSignature Language="C#" Value="public string ToRaw (RHash.HashType type);" />
          278  +      <MemberSignature Language="ILAsm" Value=".method public hidebysig instance string ToRaw(valuetype RHash.HashType type) cil managed" />
          279  +      <MemberType>Method</MemberType>
          280  +      <AssemblyInfo>
          281  +        <AssemblyVersion>1.0.1.1</AssemblyVersion>
          282  +      </AssemblyInfo>
          283  +      <ReturnValue>
          284  +        <ReturnType>System.String</ReturnType>
          285  +      </ReturnValue>
          286  +      <Parameters>
          287  +        <Parameter Name="type" Type="RHash.HashType" />
          288  +      </Parameters>
          289  +      <Docs>
          290  +        <param name="type">Type of hashing algorithm.</param>
          291  +        <summary>Returns value of computed digest as raw bytes encoded in ANSI string.</summary>
          292  +        <returns>Message digest as raw bytes encoded in an ANSI string.</returns>
          293  +        <remarks>To be added.</remarks>
          294  +        <exception cref="T:System.ArgumentException">This Hasher does not compute hash of given type.</exception>
          295  +      </Docs>
          296  +    </Member>
          297  +    <Member MemberName="ToString">
          298  +      <MemberSignature Language="C#" Value="public override string ToString ();" />
          299  +      <MemberSignature Language="ILAsm" Value=".method public hidebysig virtual instance string ToString() cil managed" />
          300  +      <MemberType>Method</MemberType>
          301  +      <AssemblyInfo>
          302  +        <AssemblyVersion>1.0.1.1</AssemblyVersion>
          303  +      </AssemblyInfo>
          304  +      <ReturnValue>
          305  +        <ReturnType>System.String</ReturnType>
          306  +      </ReturnValue>
          307  +      <Parameters />
          308  +      <Docs>
          309  +        <summary>Returns value of computed digest as string in default format.</summary>
          310  +        <returns>Message digest as string.</returns>
          311  +        <remarks>For Hasher created using <see cref="C:RHash.Hasher(RHash.HashType)" /> constructor, this method returns the same string as <see cref="M:RHash.Hasher.ToString(RHash.HashType)" /> method with the hash type used in constructor.</remarks>
          312  +      </Docs>
          313  +    </Member>
          314  +    <Member MemberName="ToString">
          315  +      <MemberSignature Language="C#" Value="public string ToString (RHash.HashType type);" />
          316  +      <MemberSignature Language="ILAsm" Value=".method public hidebysig instance string ToString(valuetype RHash.HashType type) cil managed" />
          317  +      <MemberType>Method</MemberType>
          318  +      <AssemblyInfo>
          319  +        <AssemblyVersion>1.0.1.1</AssemblyVersion>
          320  +      </AssemblyInfo>
          321  +      <ReturnValue>
          322  +        <ReturnType>System.String</ReturnType>
          323  +      </ReturnValue>
          324  +      <Parameters>
          325  +        <Parameter Name="type" Type="RHash.HashType" />
          326  +      </Parameters>
          327  +      <Docs>
          328  +        <param name="type">Type of hashing algorithm.</param>
          329  +        <summary>Returns value of computed digest as string in default format.</summary>
          330  +        <returns>Message digest for given hashing algorithm.</returns>
          331  +        <remarks>If default output for hashing algorithm is base32 then
          332  +returned value is the same as if <see cref="M:RHash.Hasher.ToBase32(RHash.HashType)" /> method was called;
          333  +otherwise value is the same as returned by <see cref="M:RHash.Hasher.ToHex(RHash.HashType)" /> method.</remarks>
          334  +        <exception cref="T:System.ArgumentException">This Hasher does not compute hash of given type.</exception>
          335  +      </Docs>
          336  +    </Member>
          337  +    <Member MemberName="Update">
          338  +      <MemberSignature Language="C#" Value="public RHash.Hasher Update (byte[] buf);" />
          339  +      <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class RHash.Hasher Update(unsigned int8[] buf) cil managed" />
          340  +      <MemberType>Method</MemberType>
          341  +      <AssemblyInfo>
          342  +        <AssemblyVersion>1.0.1.1</AssemblyVersion>
          343  +      </AssemblyInfo>
          344  +      <ReturnValue>
          345  +        <ReturnType>RHash.Hasher</ReturnType>
          346  +      </ReturnValue>
          347  +      <Parameters>
          348  +        <Parameter Name="buf" Type="System.Byte[]" />
          349  +      </Parameters>
          350  +      <Docs>
          351  +        <param name="buf">Data for hashing.</param>
          352  +        <summary>Updates this Hasher with new data chunk.</summary>
          353  +        <returns>This hasher.</returns>
          354  +        <remarks>To be added.</remarks>
          355  +      </Docs>
          356  +    </Member>
          357  +    <Member MemberName="Update">
          358  +      <MemberSignature Language="C#" Value="public RHash.Hasher Update (byte[] buf, int len);" />
          359  +      <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class RHash.Hasher Update(unsigned int8[] buf, int32 len) cil managed" />
          360  +      <MemberType>Method</MemberType>
          361  +      <AssemblyInfo>
          362  +        <AssemblyVersion>1.0.1.1</AssemblyVersion>
          363  +      </AssemblyInfo>
          364  +      <ReturnValue>
          365  +        <ReturnType>RHash.Hasher</ReturnType>
          366  +      </ReturnValue>
          367  +      <Parameters>
          368  +        <Parameter Name="buf" Type="System.Byte[]" />
          369  +        <Parameter Name="len" Type="System.Int32" />
          370  +      </Parameters>
          371  +      <Docs>
          372  +        <param name="buf">Data for hashing.</param>
          373  +        <param name="len">Number of bytes in array to hash.</param>
          374  +        <summary>Updates this Hasher with new data chunk.</summary>
          375  +        <returns>This Hasher.</returns>
          376  +        <remarks>To be added.</remarks>
          377  +        <exception cref="T:System.IndexOutOfRangeException">Argument len is negative or greater than buffer length.</exception>
          378  +      </Docs>
          379  +    </Member>
          380  +    <Member MemberName="UpdateFile">
          381  +      <MemberSignature Language="C#" Value="public RHash.Hasher UpdateFile (string filename);" />
          382  +      <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class RHash.Hasher UpdateFile(string filename) cil managed" />
          383  +      <MemberType>Method</MemberType>
          384  +      <AssemblyInfo>
          385  +        <AssemblyVersion>1.0.1.1</AssemblyVersion>
          386  +      </AssemblyInfo>
          387  +      <ReturnValue>
          388  +        <ReturnType>RHash.Hasher</ReturnType>
          389  +      </ReturnValue>
          390  +      <Parameters>
          391  +        <Parameter Name="filename" Type="System.String" />
          392  +      </Parameters>
          393  +      <Docs>
          394  +        <param name="filename">Name of the file to process.</param>
          395  +        <summary>Updates this Hasher with data from given file.</summary>
          396  +        <returns>This Hasher.</returns>
          397  +        <remarks>To be added.</remarks>
          398  +      </Docs>
          399  +    </Member>
          400  +  </Members>
          401  +</Type>

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/bindings/mono/doc/index.xml version [bb64bd3eb9].

            1  +<Overview>
            2  +  <Assemblies>
            3  +    <Assembly Name="RHash" Version="1.0.1.1">
            4  +      <AssemblyPublicKey>[00 24 00 00 04 80 00 00 94 00 00 00 06 02 00 00 00 24 00 00 52 53 41 31 00 04 00 00 11 00 00 00 2f cc 17 f0 6f bb a5 89 23 fa 26 a6 d9 a2 2a 73 c1 0f 82 84 6c e3 b5 d2 ba a3 82 ef 40 c8 88 8d 16 98 9d 5f a5 ce a5 a8 7c 4e 3d 9f 3a f9 ff 99 a4 d8 c2 51 a8 45 ca a7 df 00 7c 92 07 50 44 60 2a 2f 9c 08 76 6c 4d 61 1a 51 4f 46 44 ff 8f 52 98 25 e8 04 08 35 ee a5 ac 32 b2 eb 4b d6 b0 b0 c5 9b 39 48 0f c7 c9 6e 16 9d b9 33 aa 9e f4 54 21 a2 8d 0a 47 9b fd 15 5f c2 17 b6 09 9f 52 8f ]</AssemblyPublicKey>
            5  +      <Attributes>
            6  +        <Attribute>
            7  +          <AttributeName>System.Reflection.AssemblyCompany("")</AttributeName>
            8  +        </Attribute>
            9  +        <Attribute>
           10  +          <AttributeName>System.Reflection.AssemblyConfiguration("")</AttributeName>
           11  +        </Attribute>
           12  +        <Attribute>
           13  +          <AttributeName>System.Reflection.AssemblyCopyright("(c) 2011, Sergey Basalaev")</AttributeName>
           14  +        </Attribute>
           15  +        <Attribute>
           16  +          <AttributeName>System.Reflection.AssemblyDescription(".NET/Mono bindings for librhash")</AttributeName>
           17  +        </Attribute>
           18  +        <Attribute>
           19  +          <AttributeName>System.Reflection.AssemblyProduct("")</AttributeName>
           20  +        </Attribute>
           21  +        <Attribute>
           22  +          <AttributeName>System.Reflection.AssemblyTitle("RHash")</AttributeName>
           23  +        </Attribute>
           24  +        <Attribute>
           25  +          <AttributeName>System.Reflection.AssemblyTrademark("")</AttributeName>
           26  +        </Attribute>
           27  +        <Attribute>
           28  +          <AttributeName>System.Runtime.CompilerServices.RuntimeCompatibility(WrapNonExceptionThrows=true)</AttributeName>
           29  +        </Attribute>
           30  +      </Attributes>
           31  +    </Assembly>
           32  +  </Assemblies>
           33  +  <Remarks>To be added.</Remarks>
           34  +  <Copyright>(c) 2011, Sergey Basalaev</Copyright>
           35  +  <Types>
           36  +    <Namespace Name="RHash">
           37  +      <Type Name="Hasher" Kind="Class" />
           38  +      <Type Name="HashType" Kind="Enumeration" />
           39  +    </Namespace>
           40  +  </Types>
           41  +  <Title>RHash</Title>
           42  +</Overview>

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/bindings/mono/doc/ns-RHash.xml version [f2410c914e].

            1  +<Namespace Name="RHash">
            2  +  <Docs>
            3  +    <summary>.NET/Mono bindings to librhash.</summary>
            4  +    <remarks>
            5  +<para>Librhash is a library for computing and verifying hash sums
            6  +that supports many hashing algorithms. This module provides
            7  +class for incremental hashing that utilizes the library.
            8  +Sample usage of it you can see from the following example:
            9  +<example><code lang="C#">
           10  +  Hasher hasher = new Hasher((uint)HashType.CRC32 | (uint)HashType.MD5);
           11  +  hasher.Update(bytebuffer).UpdateFile("SomeFile.txt");
           12  +  hasher.Finish();
           13  +  Console.WriteLine(hasher.ToHex(HashType.CRC32));
           14  +  Console.WriteLine(hasher.ToBase32(HashType.MD5));</code></example>
           15  +</para><para>
           16  + In this example <see cref="T:RHash.Hasher" /> object is first
           17  + created for a set of hashing algorithms.
           18  +</para><para>
           19  + Next, data for hashing is  given  in  chunks  with  methods
           20  + Update() and UpdateFile(). Finally, call Finish() to end up
           21  + all remaining calculations.
           22  +</para><para>
           23  + To receive text represenation of the message digest use one
           24  + of methods ToHex(), ToBase32() and ToBase64(). Binary message
           25  + digest may be obtained with ToRaw(). All of these methods accept
           26  + algorithm  value as argument. It may be omitted if Hasher was
           27  + created to compute hash for only a single hashing algorithm.
           28  +</para>
           29  +</remarks>
           30  +  </Docs>
           31  +</Namespace>

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/bindings/mono/test/12345.txt version [2672275fe0].

            1  +12345

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/bindings/mono/test/Makefile version [9eed0483ff].

            1  +#!/usr/bin/make -f
            2  +
            3  +# This file is a part of Mono Bindings for Librhash
            4  +# Copyright (c) 2011-2012, Sergey Basalaev <sbasalaev@gmail.com>
            5  +# Librhash is (c) 2011-2012, Aleksey Kravchenko <rhash.admin@gmail.com>
            6  +# 
            7  +# Permission is hereby granted, free of charge,  to any person obtaining a copy
            8  +# of this software and associated documentation files (the "Software"), to deal
            9  +# in the Software without restriction,  including without limitation the rights
           10  +# to  use,  copy,  modify,  merge, publish, distribute, sublicense, and/or sell
           11  +# copies  of  the Software,  and  to permit  persons  to whom  the Software  is
           12  +# furnished to do so.
           13  +# 
           14  +# This library  is distributed  in the hope that it will be useful, but WITHOUT
           15  +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
           16  +# FOR A PARTICULAR PURPOSE. Use it at your own risk!
           17  +
           18  +MONO?=mono
           19  +CS?=mcs
           20  +MONO_PATH?=..
           21  +
           22  +test: Test.exe
           23  +	MONO_PATH="$(MONO_PATH)" $(MONO) Test.exe
           24  +
           25  +Test.exe: Test.cs
           26  +	$(CS) -r:RHash.dll -lib:.. Test.cs
           27  +
           28  +clean:
           29  +	rm -f Test.exe

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/bindings/mono/test/Test.cs version [1001df5bc7].

            1  +/*
            2  + * This file is a part of Mono Bindings for Librhash
            3  + * Copyright (c) 2011-2012, Sergey Basalaev <sbasalaev@gmail.com>
            4  + * Librhash is (c) 2011-2012, Aleksey Kravchenko <rhash.admin@gmail.com>
            5  + * 
            6  + * Permission is hereby granted, free of charge,  to any person obtaining a copy
            7  + * of this software and associated documentation files (the "Software"), to deal
            8  + * in the Software without restriction,  including without limitation the rights
            9  + * to  use,  copy,  modify,  merge, publish, distribute, sublicense, and/or sell
           10  + * copies  of  the Software,  and  to permit  persons  to whom  the Software  is
           11  + * furnished to do so.
           12  + * 
           13  + * This library  is distributed  in the hope that it will be useful, but WITHOUT
           14  + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
           15  + * FOR A PARTICULAR PURPOSE. Use it at your own risk!
           16  + */
           17  +
           18  +using System;
           19  +using System.Collections.Generic;
           20  +using RHash;
           21  +
           22  +class Test {
           23  +	static void Main(string[] args) {
           24  +		byte[] testbytes = {(byte)'1', (byte)'2', (byte)'3', (byte)'4', (byte)'5', (byte)'\n'};
           25  +	
           26  +		Dictionary<HashType,string> hashes = new Dictionary<HashType,string>();
           27  +		hashes.Add(HashType.CRC32,     "261dafe6");
           28  +		hashes.Add(HashType.MD4,       "b1a45cdad19cb02482323fac9cea9b9f");
           29  +		hashes.Add(HashType.MD5,       "d577273ff885c3f84dadb8578bb41399");
           30  +		hashes.Add(HashType.SHA1,      "2672275fe0c456fb671e4f417fb2f9892c7573ba");
           31  +		hashes.Add(HashType.SHA224,    "ea2fa9708c96b4acb281be31fa98827addc5017305b7a038a3fca413");
           32  +		hashes.Add(HashType.SHA256,    "f33ae3bc9a22cd7564990a794789954409977013966fb1a8f43c35776b833a95");
           33  +		hashes.Add(HashType.SHA384,    "4e1cbb008acaa65ba788e3f150f7a8689c8fca289a57a65ef65b28f11ba61e59c3f4ddf069ca9521a9ac0e02eade4dae");
           34  +		hashes.Add(HashType.SHA512,    "f2dc0119c9dac46f49d3b7d0be1f61adf7619b770ff076fb11a2f61ff3fcba6b68d224588c4983670da31b33b4efabd448e38a2fda508622cc33ff8304ddf49c");
           35  +		hashes.Add(HashType.TIGER,     "6a31f8b7b80bab8b45263f56b5f609f93daf47d0a086bda5");
           36  +		hashes.Add(HashType.TTH,       "dctamcmte5tqwam5afghps2xpx3yeozwj2odzcq");
           37  +		//hashes.Add(HashType.BTIH,      "d4344cf79b89e4732c6241e730ac3f945d7a774c");
           38  +		hashes.Add(HashType.AICH,      "ezzcox7ayrlpwzy6j5ax7mxzrewhk452");
           39  +		hashes.Add(HashType.ED2K,      "b1a45cdad19cb02482323fac9cea9b9f");
           40  +		hashes.Add(HashType.WHIRLPOOL, "0e8ce019c9d5185d2103a4ff015ec92587da9b22e77ad34f2eddbba9705b3602bc6ede67f5b5e4dd225e7762208ea54895b26c39fc550914d6eca9604b724d11");
           41  +		hashes.Add(HashType.GOST,      "0aaaf17200323d024437837d6f6f6384a4a108474cff03cd349ac12776713f5f");
           42  +		hashes.Add(HashType.GOST_CRYPTOPRO, "2ed45a995ffdd7a2e5d9ab212c91cec5c65448e6a0840749a00f326ccb0c936d");
           43  +		hashes.Add(HashType.RIPEMD160, "ead888178685c5d3a0400befba9188e4da3d5144");
           44  +		hashes.Add(HashType.HAS160,    "c7589afd23462e76703b1f7a031010eec70180d4");
           45  +		hashes.Add(HashType.SNEFRU128, "d559a2b62f6f44111324f85208723707");
           46  +		hashes.Add(HashType.SNEFRU256, "1b59927d85a9349a87796620fe2ff401a06a7ba48794498ebab978efc3a68912");
           47  +		hashes.Add(HashType.EDONR256,  "c3d2bbfd63f7461a806f756bf4efeb224036331a9c1d867d251e9e480b18e6fb");
           48  +		hashes.Add(HashType.EDONR512,  "a040056378fbd1f9a528677defd141c964fab9c429003fecf2eadfc20c8980cf2e083a1b4e74d5369af3cc0537bcf9b386fedf3613c9ee6c44f54f11bcf3feae");
           49  +		hashes.Add(HashType.SHA3_224,  "952f55abd73d0efd9656982f65c4dc837a6a129de02464b85d04cb18");
           50  +		hashes.Add(HashType.SHA3_256,  "f627c8f9355399ef45e1a6b6e5a9e6a3abcb3e1b6255603357bffa9f2211ba7e");
           51  +		hashes.Add(HashType.SHA3_384,  "0529075e85bcdc06da94cbc83c53b7402c5032440210a1a24d9ccca481ddbd6c1309ae0ef23741f13352a4f3382dee51");
           52  +		hashes.Add(HashType.SHA3_512,  "fdd7e7b9655f4f0ef89056e864a2d2dce3602404480281c88455e3a98f728aa08b3f116e6b434200a035e0780d9237ca367c976c5506f7c6f367e6b65447d97c");
           53  +
           54  +		Console.WriteLine("\nTests: hashes for message");
           55  +		int errcount1 = 0;
           56  +		foreach (HashType t in hashes.Keys) {
           57  +			string mustbe = hashes[t];
           58  +			string got    = Hasher.GetHashForMsg(testbytes, t);
           59  +			if (!got.Equals(mustbe)) {
           60  +				Console.WriteLine("Test for {0} failed: expected '{1}', got '{2}'\n", t, mustbe, got);
           61  +				errcount1++;
           62  +			}
           63  +		}
           64  +		Console.WriteLine("{0} tests / {1} failed\n", hashes.Count, errcount1);
           65  +
           66  +		Console.WriteLine("\nTests: hashes for file");
           67  +		int errcount2 = 0;
           68  +		foreach (HashType t in hashes.Keys) {
           69  +			string mustbe = hashes[t];
           70  +			string got    = Hasher.GetHashForFile("12345.txt", t);
           71  +			if (!got.Equals(mustbe)) {
           72  +				Console.WriteLine("Test for {0} failed: expected '{1}', got '{2}'\n", t, mustbe, got);
           73  +				errcount2++;
           74  +			}
           75  +		}
           76  +		Console.WriteLine("{0} tests / {1} failed\n", hashes.Count, errcount2);
           77  +		
           78  +        Console.WriteLine("\nTests: magnet links");
           79  +        int errcount3 = 0;
           80  +		{
           81  +	        // magnet by static method
           82  +    	    string mustbe = "magnet:?xl=6&dn=12345.txt&xt=urn:crc32:261dafe6&xt=urn:md5:d577273ff885c3f84dadb8578bb41399";
           83  +        	string got = Hasher.GetMagnetFor("12345.txt", (uint)HashType.CRC32 | (uint)HashType.MD5);
           84  +	        if (!got.Equals(mustbe)) {
           85  +    	        Console.WriteLine("Magnet by static method test failed: expected '{0}', got '{1}'\n", mustbe, got);
           86  +        	    errcount3++;
           87  +	        }
           88  +    	    // magnet with null argument
           89  +	        Hasher hasher = new Hasher((uint)HashType.CRC32 | (uint)HashType.MD5);
           90  +	        hasher.UpdateFile("12345.txt").Finish();
           91  +	        mustbe = "magnet:?xl=6&xt=urn:crc32:261dafe6";
           92  +	        got = hasher.GetMagnet(null, (uint)HashType.CRC32 | (uint)HashType.AICH);
           93  +	        if (!got.Equals(mustbe)) {
           94  +	            Console.WriteLine("Magnet with null argument test failed: expected '{0}', got '{1}'\n", mustbe, got);
           95  +	            errcount3++;
           96  +	        }
           97  +		}
           98  +        Console.WriteLine("{0} tests / {1} failed\n", 2, errcount3);
           99  +
          100  +		System.Environment.ExitCode = errcount1 + errcount2 + errcount3;
          101  +	}
          102  +}

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/bindings/perl/.gitignore version [93be51090b].

            1  +blib/
            2  +Makefile
            3  +Rhash.c
            4  +Rhash.bs
            5  +pm_to_blib
            6  +MYMETA.*

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/bindings/perl/MANIFEST version [221d15c85d].

            1  +Makefile.PL
            2  +README
            3  +Rhash.pm
            4  +Rhash.xs
            5  +t/1test_hash_calculation.t
            6  +t/2test_static_functions.t
            7  +t/3test_all_hash_functions.t
            8  +typemap
            9  +MANIFEST
           10  +META.yml                                 Module YAML meta-data (added by MakeMaker)
           11  +META.json                                Module JSON meta-data (added by MakeMaker)

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/bindings/perl/META.json version [293c700a1e].

            1  +{
            2  +   "abstract" : "Library for computing hash sums and magnet links",
            3  +   "author" : [
            4  +      "Aleksey Kravchenko"
            5  +   ],
            6  +   "dynamic_config" : 0,
            7  +   "generated_by" : "ExtUtils::MakeMaker version 6.84, CPAN::Meta::Converter version 2.133380",
            8  +   "license" : [
            9  +      "unrestricted"
           10  +   ],
           11  +   "meta-spec" : {
           12  +      "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
           13  +      "version" : "2"
           14  +   },
           15  +   "name" : "Crypt-Rhash",
           16  +   "no_index" : {
           17  +      "directory" : [
           18  +         "t",
           19  +         "inc"
           20  +      ]
           21  +   },
           22  +   "prereqs" : {
           23  +      "build" : {
           24  +         "requires" : {
           25  +            "ExtUtils::MakeMaker" : "0"
           26  +         }
           27  +      },
           28  +      "configure" : {
           29  +         "requires" : {
           30  +            "ExtUtils::MakeMaker" : "0"
           31  +         }
           32  +      },
           33  +      "runtime" : {
           34  +         "requires" : {}
           35  +      }
           36  +   },
           37  +   "release_status" : "stable",
           38  +   "resources" : {
           39  +      "bugtracker" : {
           40  +         "web" : "https://sourceforge.net/p/rhash/bugs/"
           41  +      },
           42  +      "homepage" : "http://rhash.sf.net/",
           43  +      "license" : [
           44  +         "http://rhash.anz.ru/license.php"
           45  +      ],
           46  +      "repository" : {
           47  +         "url" : "https://github.com/rhash/RHash"
           48  +      }
           49  +   },
           50  +   "version" : "0.94"
           51  +}

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/bindings/perl/META.yml version [47a1b44c5e].

            1  +---
            2  +abstract: 'Library for computing hash sums and magnet links'
            3  +author:
            4  +  - 'Aleksey Kravchenko'
            5  +build_requires:
            6  +  ExtUtils::MakeMaker: 0
            7  +configure_requires:
            8  +  ExtUtils::MakeMaker: 0
            9  +dynamic_config: 0
           10  +generated_by: 'ExtUtils::MakeMaker version 6.84, CPAN::Meta::Converter version 2.133380'
           11  +license: unrestricted
           12  +meta-spec:
           13  +  url: http://module-build.sourceforge.net/META-spec-v1.4.html
           14  +  version: 1.4
           15  +name: Crypt-Rhash
           16  +no_index:
           17  +  directory:
           18  +    - t
           19  +    - inc
           20  +requires: {}
           21  +resources:
           22  +  bugtracker: https://sourceforge.net/p/rhash/bugs/
           23  +  homepage: http://rhash.sf.net/
           24  +  license: http://rhash.anz.ru/license.php
           25  +  repository: https://github.com/rhash/RHash
           26  +version: 0.94

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/bindings/perl/Makefile.PL version [924e78267b].

            1  +use strict;
            2  +use warnings;
            3  +use ExtUtils::MakeMaker;
            4  +use File::Copy;
            5  +
            6  +my $libs  = '';
            7  +my $inc   = '';
            8  +my $obj   = '';
            9  +my $clean = '';
           10  +
           11  +# set the location of LibRHash headers and the linking flags
           12  +$inc = $ENV{'LIBRHASH_INC'} if defined($ENV{'LIBRHASH_INC'});
           13  +if(defined($ENV{'LIBRHASH_LD'}) && $ENV{'LIBRHASH_LD'} =~ /-L/) {
           14  +    $libs = $ENV{'LIBRHASH_LD'} . ' ' . $libs;
           15  +}
           16  +
           17  +# use a system-wide librhash
           18  +$libs = '-lrhash' if (defined($ENV{'USE_SYSTEM_LIBRHASH'}));
           19  +
           20  +# copy and rename *.c files by prepending underscore '_'
           21  +sub copy_c_files($) {
           22  +	my $from_dir = $_[0];
           23  +	my @result = ();
           24  +	(opendir my($dh), $from_dir) or die "Can't open $from_dir: $!";
           25  +	my @files = grep { /(?<!\Atest_hashes)\.c$/ } readdir $dh;
           26  +	closedir $dh;
           27  +	for (@files) {
           28  +		my ($from, $to) = ("$from_dir/$_", "_$_");
           29  +		push @result, $to;
           30  +
           31  +		my ($df, $dt) = ((stat($from))[9], (stat($to))[9]);
           32  +		next if(defined($dt) && defined($df) && $dt >= $df);
           33  +		#print "copy $from -> $to\n";
           34  +		copy($from, $to)
           35  +			or die "Can't copy $from to $to: $!";
           36  +	}
           37  +	return @result;
           38  +}
           39  +
           40  +my $local_dir = 'librhash';
           41  +if($inc eq '' && $libs eq '' && -f $local_dir . '/rhash.h') {
           42  +	# use the local version of librhash
           43  +	print "Using builtin LibRHash\n";
           44  +	$inc = '-I' . $local_dir;
           45  +	my @c_files = copy_c_files($local_dir);
           46  +	$clean = join(' ', @c_files);
           47  +	$obj = join(' ', map { s/\.c$/\$(OBJ_EXT)/; $_ } @c_files) . ' ';
           48  +}
           49  +
           50  +# make setting optional MakeMaker parameters more readable
           51  +sub OPTIONAL {
           52  +	return () unless $ExtUtils::MakeMaker::VERSION ge shift;
           53  +	return @_;
           54  +}
           55  +
           56  +# see ExtUtils::MakeMaker.pm for details of how to influence
           57  +# the contents of the Makefile that is written
           58  +WriteMakefile(
           59  +    NAME         => 'Crypt::Rhash',
           60  +    ABSTRACT     => 'Library for computing hash sums and magnet links',
           61  +    AUTHOR       => 'Aleksey Kravchenko',
           62  +    VERSION_FROM => 'Rhash.pm', # finds $VERSION
           63  +    OPTIONAL( '6.31',
           64  +        LICENSE => 'unrestricted',
           65  +    ),
           66  +    OPTIONAL( '6.46',
           67  +        # Use META_ADD instead of META_MERGE so that we can remove
           68  +        # any build-time dependencies that MakeMaker will put into
           69  +        # the requires field.
           70  +        META_ADD => {
           71  +            resources => {
           72  +                homepage    => 'http://rhash.sf.net/',
           73  +                license     => 'http://rhash.anz.ru/license.php',
           74  +                bugtracker  => 'https://sourceforge.net/p/rhash/bugs/',
           75  +                repository  => 'https://github.com/rhash/RHash',
           76  +            },
           77  +        },
           78  +    ),
           79  +
           80  +    LIBS         => [ $libs ],
           81  +    DEFINE       => '',       # e.g., '-DHAVE_SOMETHING'
           82  +    INC          => $inc,     # e.g., '-I/usr/include/other'
           83  +    OBJECT       => $obj . 'Rhash$(OBJ_EXT)',
           84  +    clean        => {
           85  +        FILES => $clean,
           86  +    },
           87  +);

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/bindings/perl/README version [fb271733a4].

            1  +
            2  +Crypt::Rhash module allows to compute various hash sums and magnet links.
            3  +
            4  +The following hash sums are supported: CRC32, MD4, MD5, SHA1,
            5  +SHA256, SHA512, SHA3, Tiger, TTH, Torrent BTIH, AICH, ED2K,
            6  +GOST R 34.11-94, RIPEMD-160, HAS-160, EDON-R 256/512, WHIRLPOOL
            7  +and SNEFRU.
            8  +
            9  +BUILDING THE MODULE
           10  +-------------------
           11  +
           12  +The module can be built using the sequence of commands:
           13  +
           14  +    perl Makefile.PL
           15  +    make
           16  +    make test
           17  +
           18  +INSTALLATION
           19  +------------
           20  +
           21  +To install Crypt::Rhash, run the following command:
           22  +
           23  +    make install
           24  +
           25  +LICENSE
           26  +-------
           27  +
           28  +Permission is hereby granted, free of charge,  to any person obtaining a copy
           29  +of this software and associated documentation files (the "Software"), to deal
           30  +in the Software without restriction,  including without limitation the rights
           31  +to  use,  copy,  modify,  merge, publish, distribute, sublicense, and/or sell
           32  +copies  of  the Software,  and  to permit  persons  to whom  the Software  is
           33  +furnished to do so.
           34  +
           35  +This program  is distributed  in the hope that it will be useful, but WITHOUT
           36  +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
           37  +FOR A PARTICULAR PURPOSE.  Use  this  program  at  your  own  risk!

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/bindings/perl/Rhash.pm version [19c7a6d962].

            1  +package Crypt::Rhash;
            2  +
            3  +use 5.008008;
            4  +use strict;
            5  +use warnings;
            6  +
            7  +require Exporter;
            8  +our @ISA = (qw(Exporter));
            9  +
           10  +# possible tags for export
           11  +our %EXPORT_TAGS = (
           12  +	Functions => [qw(raw2hex raw2base32 raw2base64)],
           13  +	Constants => [qw(RHASH_CRC32 RHASH_MD4 RHASH_MD5 RHASH_SHA1 RHASH_TIGER
           14  +		RHASH_TTH RHASH_BTIH RHASH_ED2K RHASH_AICH RHASH_WHIRLPOOL
           15  +		RHASH_RIPEMD160 RHASH_GOST RHASH_GOST_CRYPTOPRO RHASH_HAS160
           16  +		RHASH_SNEFRU128 RHASH_SNEFRU256 RHASH_SHA224 RHASH_SHA256
           17  +		RHASH_SHA384 RHASH_SHA512 RHASH_EDONR256 RHASH_EDONR512
           18  +		RHASH_SHA3_224 RHASH_SHA3_256 RHASH_SHA3_384 RHASH_SHA3_512 RHASH_ALL)]
           19  +);
           20  +
           21  +Exporter::export_tags( );
           22  +Exporter::export_ok_tags( qw(Functions Constants) );
           23  +
           24  +our $VERSION = '0.94';
           25  +
           26  +require XSLoader;
           27  +XSLoader::load('Crypt::Rhash', $VERSION);
           28  +
           29  +##############################################################################
           30  +# ids of hash functions
           31  +use constant RHASH_CRC32 => 0x01;
           32  +use constant RHASH_MD4   => 0x02;
           33  +use constant RHASH_MD5   => 0x04;
           34  +use constant RHASH_SHA1  => 0x08;
           35  +use constant RHASH_TIGER => 0x10;
           36  +use constant RHASH_TTH   => 0x20;
           37  +use constant RHASH_BTIH  => 0x40;
           38  +use constant RHASH_ED2K  => 0x80;
           39  +use constant RHASH_AICH  => 0x100;
           40  +use constant RHASH_WHIRLPOOL => 0x200;
           41  +use constant RHASH_RIPEMD160 => 0x400;
           42  +use constant RHASH_GOST      => 0x800;
           43  +use constant RHASH_GOST_CRYPTOPRO => 0x1000;
           44  +use constant RHASH_HAS160    => 0x2000;
           45  +use constant RHASH_SNEFRU128 => 0x4000;
           46  +use constant RHASH_SNEFRU256 => 0x8000;
           47  +use constant RHASH_SHA224    => 0x10000;
           48  +use constant RHASH_SHA256    => 0x20000;
           49  +use constant RHASH_SHA384    => 0x40000;
           50  +use constant RHASH_SHA512    => 0x80000;
           51  +use constant RHASH_EDONR256  => 0x100000;
           52  +use constant RHASH_EDONR512  => 0x200000;
           53  +use constant RHASH_SHA3_224  => 0x0400000;
           54  +use constant RHASH_SHA3_256  => 0x0800000;
           55  +use constant RHASH_SHA3_384  => 0x1000000;
           56  +use constant RHASH_SHA3_512  => 0x2000000;
           57  +use constant RHASH_ALL       => 0x3FFFFFF;
           58  +
           59  +##############################################################################
           60  +# Rhash class methods
           61  +
           62  +# Rhash object constructor
           63  +sub new
           64  +{
           65  +	my $hash_id = $_[1] or die "hash_id not specified";
           66  +	my $context = rhash_init(scalar($hash_id)) or return undef;
           67  +	my $self = {
           68  +		context => $context,
           69  +	};
           70  +	return bless $self;
           71  +}
           72  +
           73  +# destructor
           74  +sub DESTROY($)
           75  +{
           76  +	my $self = shift;
           77  +	# the 'if' added as workaround for perl 'global destruction' bug
           78  +	# ($self->{context} can disappear on global destruction)
           79  +	rhash_free($self->{context}) if $self->{context};
           80  +}
           81  +
           82  +sub update($$)
           83  +{
           84  +	my $self = shift;
           85  +	my $message = shift;
           86  +	rhash_update($self->{context}, $message);
           87  +	return $self;
           88  +}
           89  +
           90  +sub update_fd($$;$$)
           91  +{
           92  +	my ($self, $fd, $start, $size) = @_;
           93  +	my $res = 0;
           94  +	my $num = 0;
           95  +
           96  +	binmode($fd);
           97  +	if(defined($start)) {
           98  +		seek($fd, scalar($start), 0) or return undef;
           99  +	}
          100  +
          101  +	my $data;
          102  +	if(defined($size)) {
          103  +		for(my $left = scalar($size); $left > 0; $left -= 8192) {
          104  +			($res = read($fd, $data,
          105  +				($left < 8192 ? $left : 8192))) || last;
          106  +			rhash_update($self->{context}, $data);
          107  +			$num += $res;
          108  +		}
          109  +	} else {
          110  +		while( ($res = read($fd, $data, 8192)) ) {
          111  +			rhash_update($self->{context}, $data);
          112  +			$num += $res;
          113  +		}
          114  +	}
          115  +
          116  +	return (defined($res) ? $num : undef); # return undef on read error
          117  +}
          118  +
          119  +sub update_file($$;$$)
          120  +{
          121  +	my ($self, $file, $start, $size) = @_;
          122  +	open(my $fd, "<", $file) or return undef;
          123  +	my $res = $self->update_fd($fd, $start, $size);
          124  +	close($fd);
          125  +	return $res;
          126  +}
          127  +
          128  +sub final($)
          129  +{
          130  +	my $self = shift;
          131  +	rhash_final($self->{context});
          132  +	return $self;
          133  +}
          134  +
          135  +sub reset($)
          136  +{
          137  +	my $self = shift;
          138  +	rhash_reset($self->{context});
          139  +	return $self;
          140  +}
          141  +
          142  +sub hashed_length($)
          143  +{
          144  +	my $self = shift;
          145  +	return rhash_get_hashed_length($self->{context});
          146  +}
          147  +
          148  +sub hash_id($)
          149  +{
          150  +	my $self = shift;
          151  +	return rhash_get_hash_id($self->{context});
          152  +}
          153  +
          154  +##############################################################################
          155  +# Hash formatting functions
          156  +
          157  +# printing constants
          158  +use constant RHPR_DEFAULT   => 0x0;
          159  +use constant RHPR_RAW       => 0x1;
          160  +use constant RHPR_HEX       => 0x2;
          161  +use constant RHPR_BASE32    => 0x3;
          162  +use constant RHPR_BASE64    => 0x4;
          163  +use constant RHPR_UPPERCASE => 0x8;
          164  +use constant RHPR_REVERSE   => 0x10;
          165  +
          166  +sub hash($;$$)
          167  +{
          168  +	my $self = shift;
          169  +	my $hash_id = scalar(shift) || 0;
          170  +	my $print_flags = scalar(shift) || RHPR_DEFAULT;
          171  +	return rhash_print($self->{context}, $hash_id, $print_flags);
          172  +}
          173  +
          174  +sub hash_base32($;$)
          175  +{
          176  +	hash($_[0], $_[1], RHPR_BASE32);
          177  +}
          178  +
          179  +sub hash_base64($;$)
          180  +{
          181  +	hash($_[0], $_[1], RHPR_BASE64);
          182  +}
          183  +
          184  +sub hash_hex($;$)
          185  +{
          186  +	hash($_[0], $_[1], RHPR_HEX);
          187  +}
          188  +
          189  +sub hash_rhex($;$)
          190  +{
          191  +	hash($_[0], $_[1], RHPR_HEX | RHPR_REVERSE);
          192  +}
          193  +
          194  +sub hash_raw($;$)
          195  +{
          196  +	hash($_[0], $_[1], RHPR_RAW);
          197  +}
          198  +
          199  +sub magnet_link($;$$)
          200  +{
          201  +	my ($self, $filename, $hash_mask) = @_;
          202  +	return rhash_print_magnet($self->{context}, $filename, $hash_mask);
          203  +}
          204  +
          205  +our $AUTOLOAD;
          206  +
          207  +# report error if a script called unexisting method/field
          208  +sub AUTOLOAD
          209  +{
          210  +	my ($self, $field, $type, $pkg) = ($_[0], $AUTOLOAD, undef, __PACKAGE__);
          211  +	$field =~ s/.*://;
          212  +	die "function $field does not exist" if $field =~ /^(rhash_|raw2)/;
          213  +	die "no arguments specified to $field()" if !@_;
          214  +	die "the $field() argument is undefined" if !defined $self;
          215  +
          216  +	($type = ref($self)) && $type eq $pkg || die "the $field() argument is not a $pkg reference";
          217  +	my $text = (exists $self->{$field} ? "is not accessible" : "does not exist");
          218  +	die "the method $field() $text in the class $pkg";
          219  +}
          220  +
          221  +# static functions
          222  +
          223  +sub msg($$)
          224  +{
          225  +	my ($hash_id, $msg) = @_;
          226  +	my $raw = rhash_msg_raw($hash_id, $msg); # get binary hash
          227  +	return (is_base32($hash_id) ? raw2base32($raw) : raw2hex($raw));
          228  +}
          229  +
          230  +1;
          231  +__END__
          232  +# Below is Rhash module documentation in the standard POD format
          233  +
          234  +=head1 NAME
          235  +
          236  +Crypt::Rhash - Compute hash sums and magnet links
          237  +
          238  +=head1 SYNOPSIS
          239  +
          240  +  use Crypt::Rhash;
          241  +  
          242  +  my $msg = "a message text";
          243  +  print "MD5 = " . Crypt::Rhash::msg(RHASH_MD5, $msg) . "\n";
          244  +  
          245  +  # Calculate two hash functions simultaneously
          246  +  my $r = Crypt::Rhash->new(RHASH_MD5 | RHASH_SHA1);
          247  +  $r->update("a message text")->update(" another message");
          248  +  print  "MD5  = " . $r->hash(RHASH_MD5) . "\n";
          249  +  print  "SHA1 = " . $r->hash(RHASH_SHA1) . "\n";
          250  +
          251  +=head1 DESCRIPTION
          252  +
          253  +Crypt::Rhash module is an object-oriented interface to the LibRHash library,
          254  +allowing simultaneous calculation of several hash functions for a file  or a
          255  +text message.
          256  +
          257  +Resulting hash digest can be obtained in hexadecimal, BASE32, BASE64, raw
          258  +binary format or as a magnet link.
          259  +
          260  +=head1 SUPPORTED ALGORITHMS
          261  +
          262  +The module supports the following hashing algorithms:
          263  +CRC32,  MD4, MD5,  SHA1, SHA256, SHA512, SHA3,
          264  +AICH, ED2K, Tiger,  DC++ TTH,  BitTorrent BTIH, GOST R 34.11-94, RIPEMD-160,
          265  +HAS-160, EDON-R 256/512, Whirlpool and Snefru-128/256.
          266  +
          267  +=head1 CONSTRUCTOR
          268  +
          269  +Creates and returns new Crypt::Rhash object.
          270  +
          271  +  my $r = Crypt::Rhash->new($hash_id);
          272  +  my $p = new Crypt::Rhash($hash_id); # alternative way to call the constructor
          273  +
          274  +The $hash_id parameter can be union (via bitwise OR) of any of the following bit-flags:
          275  +
          276  +  RHASH_CRC32,
          277  +  RHASH_MD4,
          278  +  RHASH_MD5,
          279  +  RHASH_SHA1,
          280  +  RHASH_TIGER,
          281  +  RHASH_TTH,
          282  +  RHASH_BTIH,
          283  +  RHASH_ED2K,
          284  +  RHASH_AICH,
          285  +  RHASH_WHIRLPOOL,
          286  +  RHASH_RIPEMD160,
          287  +  RHASH_GOST,
          288  +  RHASH_GOST_CRYPTOPRO,
          289  +  RHASH_HAS160,
          290  +  RHASH_SNEFRU128,
          291  +  RHASH_SNEFRU256,
          292  +  RHASH_SHA224,
          293  +  RHASH_SHA256,
          294  +  RHASH_SHA384,
          295  +  RHASH_SHA512,
          296  +  RHASH_SHA3_224,
          297  +  RHASH_SHA3_256,
          298  +  RHASH_SHA3_384,
          299  +  RHASH_SHA3_512,
          300  +  RHASH_EDONR256,
          301  +  RHASH_EDONR512
          302  +
          303  +Also the RHASH_ALL bit mask is the union of all listed bit-flags.
          304  +So the object created via Crypt::Rhash->new(RHASH_ALL) calculates all
          305  +supported hash functions for the same data.
          306  +
          307  +=head1 COMPUTING HASHES
          308  +
          309  +=over
          310  +
          311  +=item $rhash->update( $msg )
          312  +
          313  +Calculates hashes of the $msg string.
          314  +The method can be called repeatedly with chunks of the message to be hashed.
          315  +It returns the $rhash object itself allowing the following construction:
          316  +
          317  +  $rhash = Crypt::Rhash->new(RHASH_MD5)->update( $chunk1 )->update( $chunk2 );
          318  +
          319  +=item $rhash->update_file( $file_path, $start, $size )
          320  +
          321  +=item $rhash->update_fd( $fd, $start, $size )
          322  +
          323  +Calculate a hash of the file (or its part) specified by $file_path or a file descriptor $fd.
          324  +The update_fd method doesn't close the $fd, leaving the file position after the hashed block.
          325  +The optional $start and $size specify the block of the file to hash.
          326  +No error is reported if the $size is greater than the number of the unread bytes left in the file.
          327  +
          328  +Returns the number of characters actually read, 0 at end of file, 
          329  +or undef if there was an error (in the latter case $! is also set).
          330  +
          331  +  use Crypt::Rhash;
          332  +  my $r = new Crypt::Rhash(RHASH_SHA1);
          333  +  open(my $fd, "<", "input.txt") or die "cannot open < input.txt: $!";
          334  +  while ((my $n = $r->update_fd($fd, undef, 1024) != 0)) {
          335  +      print "$n bytes hashed. The SHA1 hash is " . $r->final()->hash() . "\n";
          336  +      $r->reset();
          337  +  }
          338  +  defined($n) or die "read error for input.txt: $!";
          339  +  close($fd);
          340  +
          341  +=item $rhash->final()
          342  +
          343  +Finishes calculation for all data buffered by updating methods and stops hash
          344  +calculation. The function is called automatically by any of the 
          345  +$rhash->hash*() methods if the final() call was skipped.
          346  +
          347  +=item $rhash->reset()
          348  +
          349  +Resets the $rhash object to the initial state.
          350  +
          351  +=item $rhash->hashed_length()
          352  +
          353  +Returns the total length of the hashed message.
          354  +
          355  +=item $rhash->hash_id()
          356  +
          357  +Returns the hash mask, the $rhash object was constructed with.
          358  +
          359  +=back
          360  +
          361  +=head1 FORMATTING HASH VALUE
          362  +
          363  +Computed hash can be formatted as a hexadecimal string (in the forward or
          364  +reverse byte order), a base32/base64-encoded string or as raw binary data.
          365  +
          366  +=over
          367  +
          368  +=item $rhash->hash( $hash_id )
          369  +
          370  +Returns the hash string in the default format,
          371  +which can be hexadecimal or base32. Actually the method is equivalent of
          372  +
          373  +  (Crypt::Rhash::is_base32($hash_id) ? $rhash->hash_base32($hash_id) :
          374  +    $rhash->hash_hex($hash_id))
          375  +
          376  +If the optional $hash_id parameter is omitted or zero, then the method returns the hash
          377  +for the algorithm contained in $rhash with the lowest identifier.
          378  +
          379  +=item $rhash->hash_hex( $hash_id )
          380  +
          381  +Returns the specified hash in the hexadecimal format.
          382  +
          383  +  use Crypt::Rhash;
          384  +  my $msg = "abc";
          385  +  print "MD5 = " . Crypt::Rhash->new(RHASH_MD5)->update($msg)->hash_hex() . "\n";
          386  +
          387  +=item $rhash->hash_rhex( $hash_id )
          388  +
          389  +Returns the specified hash in the hexadecimal format with reversed order of bytes.
          390  +Some programs prefer to output the GOST R 34.11-94 hash in this format.
          391  +
          392  +=item $rhash->hash_base32( $hash_id )
          393  +
          394  +Returns the specified hash in the base32 format.
          395  +
          396  +=item $rhash->hash_base64( $hash_id )
          397  +
          398  +Returns the specified hash in the base64 format.
          399  +
          400  +=item $rhash->magnet_link( $filename, $hash_mask )
          401  +
          402  +Returns the magnet link containing the computed hashes, filesize, and,
          403  +optionaly, $filename. The $filename (if specified) is URL-encoded,
          404  +by converting special characters into the %<hexadecimal-code> form.
          405  +The optional parameter $hash_mask can limit which hash values to put
          406  +into the link.
          407  +
          408  +=back
          409  +
          410  +=head1 STATIC METHODS
          411  +
          412  +=over
          413  +
          414  +=item Crypt::Rhash::count()
          415  +
          416  +Returns the number of supported hash algorithms
          417  +
          418  +=item Crypt::Rhash::is_base32($hash_id)
          419  +
          420  +Returns nonzero if default output format is Base32 for the hash function specified by $hash_id.
          421  +Returns zero if default format is hexadecimal.
          422  +
          423  +=item Crypt::Rhash::get_digest_size($hash_id)
          424  +
          425  +Returns the size in bytes of raw binary hash of the specified hash algorithm.
          426  +
          427  +=item Crypt::Rhash::get_hash_length($hash_id)
          428  +
          429  +Returns the length of a hash string in default output format for the specified hash algorithm.
          430  +
          431  +=item Crypt::Rhash::get_name($hash_id)
          432  +
          433  +Returns the name of the specified hash algorithm.
          434  +
          435  +=back
          436  +
          437  +=head1 ALTERNATIVE WAY TO COMPUTE HASH
          438  +
          439  +=over
          440  +
          441  +=item Crypt::Rhash::msg($hash_id, $message)
          442  +
          443  +Computes and returns a single hash (in its default format) of the $message by the selected hash algorithm.
          444  +
          445  +  use Crypt::Rhash;
          446  +  print "SHA1( 'abc' ) = " . Crypt::Rhash::msg(RHASH_SHA1, "abc") . "\n";
          447  +
          448  +=back
          449  +
          450  +=head1 LICENSE
          451  +
          452  + Permission is hereby granted, free of charge,  to any person obtaining a copy
          453  + of this software and associated documentation files (the "Software"), to deal
          454  + in the Software without restriction,  including without limitation the rights
          455  + to  use,  copy,  modify,  merge, publish, distribute, sublicense, and/or sell
          456  + copies  of  the Software,  and  to permit  persons  to whom  the Software  is
          457  + furnished to do so.
          458  +
          459  + The Software  is distributed in the hope that it will be useful,  but WITHOUT
          460  + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
          461  + FOR A PARTICULAR PURPOSE.  Use  this  program  at  your  own  risk!
          462  +
          463  +=cut

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/bindings/perl/Rhash.xs version [5d1a29073b].

            1  +#include "EXTERN.h"
            2  +#include "perl.h"
            3  +#include "XSUB.h"
            4  +
            5  +#include <rhash.h>
            6  +
            7  +typedef unsigned long long ulonglong;
            8  +
            9  +/* helper macros and functions */
           10  +#define BASE32_LENGTH(size) (((size) * 8 + 4) / 5)
           11  +#define BASE64_LENGTH(size) ((((size) + 2) / 3) * 4)
           12  +
           13  +void verify_single_bit_hash_id(unsigned hash_id, CV* cv)
           14  +{
           15  +	const char* error;
           16  +	const GV *gv;
           17  +	const char *func_name;
           18  +
           19  +	if(0 == (hash_id & RHASH_ALL_HASHES)) {
           20  +		error = "%s: unknown hash hash_id = %d";
           21  +	} else if(0 != (hash_id & (hash_id - 1))) {
           22  +		error = "%s: hash_id is not a single bit: %d";
           23  +	} else {
           24  +		return; /* success */
           25  +	}
           26  +
           27  +	gv = CvGV(cv);
           28  +	func_name = (gv ? GvNAME(gv) : "Rhash");
           29  +	croak(error, func_name, hash_id);
           30  +}
           31  +
           32  +/* allocate a perl string scalar variable, containing str_len + 1 bytes */
           33  +SV * allocate_string_buffer(STRLEN str_len)
           34  +{
           35  +	SV * sv = newSV(str_len); /* allocates (str_len + 1) bytes */
           36  +	SvPOK_only(sv);
           37  +	SvCUR_set(sv, str_len);
           38  +	return sv;
           39  +}
           40  +
           41  +MODULE = Crypt::Rhash      PACKAGE = Crypt::Rhash
           42  +
           43  +##############################################################################
           44  +# Initialize LibRHash in the module bootstrap function
           45  +
           46  +BOOT:
           47  +	rhash_library_init();
           48  +
           49  +##############################################################################
           50  +# perl bindings for Hi-level functions
           51  +
           52  +SV *
           53  +rhash_msg_raw(hash_id, message)
           54  +		unsigned	hash_id
           55  +	PROTOTYPE: $$
           56  +	PREINIT:
           57  +		STRLEN length;
           58  +		unsigned char out[264];
           59  +		int res;
           60  +	INPUT:
           61  +		char* message = SvPV(ST(1), length);
           62  +	CODE:
           63  +		verify_single_bit_hash_id(hash_id, cv);
           64  +		res = rhash_msg(hash_id, message, length, out);
           65  +		if(res < 0) {
           66  +			croak("%s: %s", "rhash_msg_raw", strerror(errno));
           67  +		}
           68  +		RETVAL = newSVpv((char*)out, rhash_get_digest_size(hash_id));
           69  +	OUTPUT:
           70  +		RETVAL
           71  +
           72  +SV *
           73  +rhash_file_raw(hash_id, filepath)
           74  +		unsigned hash_id
           75  +		char * filepath
           76  +	PROTOTYPE: $$
           77  +	PREINIT:
           78  +		int res;
           79  +		unsigned char out[264];
           80  +	CODE:
           81  +		verify_single_bit_hash_id(hash_id, cv);
           82  +		res = rhash_file(hash_id, filepath, out);
           83  +		if(res < 0) {
           84  +			croak("%s: %s: %s", "rhash_file", filepath, strerror(errno));
           85  +		}
           86  +		RETVAL = newSVpv((char*)out, rhash_get_digest_size(hash_id));
           87  +	OUTPUT:
           88  +		RETVAL
           89  +
           90  +##############################################################################
           91  +# perl bindings for Low-level functions
           92  +
           93  +rhash_context *
           94  +rhash_init(hash_id)
           95  +		unsigned hash_id
           96  +	PROTOTYPE: $
           97  +
           98  +int
           99  +rhash_update(ctx, message)
          100  +		rhash_context * ctx
          101  +	PROTOTYPE: $$
          102  +	PREINIT:
          103  +		STRLEN length;
          104  +	INPUT:
          105  +		char* message = SvPV(ST(1), length);
          106  +	CODE:
          107  +		RETVAL = rhash_update(ctx, message, length);
          108  +	OUTPUT:
          109  +		RETVAL
          110  +
          111  +int
          112  +rhash_final(ctx)
          113  +		rhash_context * ctx
          114  +	PROTOTYPE: $
          115  +	CODE:
          116  +		RETVAL = rhash_final(ctx, 0);
          117  +	OUTPUT:
          118  +		RETVAL
          119  +
          120  +void
          121  +rhash_reset(ctx)
          122  +		rhash_context * ctx
          123  +	PROTOTYPE: $
          124  +
          125  +void
          126  +rhash_free(ctx)
          127  +		rhash_context * ctx
          128  +	PROTOTYPE: $
          129  +
          130  +SV *
          131  +rhash_print(ctx, hash_id, flags = 0)
          132  +		rhash_context * ctx
          133  +		unsigned hash_id
          134  +		int flags
          135  +	PROTOTYPE: $$;$
          136  +	PREINIT:
          137  +		int len;
          138  +		char out[264];
          139  +	CODE:
          140  +		if(hash_id != 0) verify_single_bit_hash_id(hash_id, cv);
          141  +
          142  +		len = rhash_print(out, ctx, hash_id, flags);
          143  +
          144  +		/* set exact length to support raw output (RHPR_RAW) */
          145  +		RETVAL = newSVpv(out, len);
          146  +	OUTPUT:
          147  +		RETVAL
          148  +
          149  +SV *
          150  +rhash_print_magnet(ctx, filename, hash_mask)
          151  +		rhash_context * ctx
          152  +		SV * filename
          153  +		SV * hash_mask
          154  +	PROTOTYPE: $;$$
          155  +	PREINIT:
          156  +		/* process undefined values */
          157  +		char * name = (SvOK(filename) ? SvPV_nolen(filename) : 0);
          158  +		unsigned mask = (SvOK(hash_mask) ? (unsigned)SvUV(hash_mask) : RHASH_ALL_HASHES);
          159  +		size_t buf_size;
          160  +	CODE:
          161  +		/* allocate a string buffer and print magnet link into it */
          162  +		buf_size = rhash_print_magnet(0, name, ctx, mask, RHPR_FILESIZE);
          163  +		RETVAL = allocate_string_buffer(buf_size - 1);
          164  +		rhash_print_magnet(SvPVX(RETVAL), name, ctx, mask, RHPR_FILESIZE);
          165  +
          166  +		/* note: length(RETVAL) = (buf_size - 1),
          167  +		 * so the following call is not required:
          168  +		 * SvCUR_set(RETVAL, strlen(SvPVX(RETVAL))); */
          169  +	OUTPUT:
          170  +		RETVAL
          171  +
          172  +unsigned
          173  +rhash_get_hash_id(ctx)
          174  +		rhash_context * ctx
          175  +	PROTOTYPE: $
          176  +	CODE:
          177  +		RETVAL = ctx->hash_id;
          178  +	OUTPUT:
          179  +		RETVAL
          180  +
          181  +ulonglong
          182  +rhash_get_hashed_length(ctx)
          183  +		rhash_context * ctx
          184  +	PROTOTYPE: $
          185  +	CODE:
          186  +		RETVAL = ctx->msg_size;
          187  +	OUTPUT:
          188  +		RETVAL
          189  +
          190  +##############################################################################
          191  +# Hash information functions
          192  +
          193  +int
          194  +count()
          195  +	CODE:
          196  +		RETVAL = rhash_count();
          197  +	OUTPUT:
          198  +		RETVAL
          199  +
          200  +int
          201  +is_base32(hash_id)
          202  +		unsigned hash_id
          203  +	PROTOTYPE: $
          204  +	CODE:
          205  +		RETVAL = rhash_is_base32(hash_id);
          206  +	OUTPUT:
          207  +		RETVAL
          208  +
          209  +int
          210  +get_digest_size(hash_id)
          211  +		unsigned hash_id
          212  +	PROTOTYPE: $
          213  +	CODE:
          214  +		RETVAL = rhash_get_digest_size(hash_id);
          215  +	OUTPUT:
          216  +		RETVAL
          217  +
          218  +int
          219  +get_hash_length(hash_id)
          220  +		unsigned hash_id
          221  +	PROTOTYPE: $
          222  +	CODE:
          223  +		RETVAL = rhash_get_hash_length(hash_id);
          224  +	OUTPUT:
          225  +		RETVAL
          226  +
          227  +const char *
          228  +get_name(hash_id)
          229  +		unsigned hash_id
          230  +	PROTOTYPE: $
          231  +	CODE:
          232  +		RETVAL = rhash_get_name(hash_id);
          233  +	OUTPUT:
          234  +		RETVAL
          235  +
          236  +##############################################################################
          237  +# Hash printing functions
          238  +
          239  +##############################################################################
          240  +# Hash conversion functions
          241  +
          242  +SV *
          243  +raw2hex(bytes)
          244  +	PROTOTYPE: $
          245  +	PREINIT:
          246  +		STRLEN size;
          247  +	INPUT:
          248  +		unsigned char * bytes = (unsigned char*)SvPV(ST(0), size);
          249  +	CODE:
          250  +		RETVAL = allocate_string_buffer(size * 2);
          251  +		rhash_print_bytes(SvPVX(RETVAL), bytes, size, RHPR_HEX);
          252  +	OUTPUT:
          253  +		RETVAL
          254  +
          255  +SV *
          256  +raw2base32(bytes)
          257  +	PROTOTYPE: $
          258  +	PREINIT:
          259  +		STRLEN size;
          260  +	INPUT:
          261  +		unsigned char * bytes = (unsigned char*)SvPV(ST(0), size);
          262  +	CODE:
          263  +		RETVAL = allocate_string_buffer(BASE32_LENGTH(size));
          264  +		rhash_print_bytes(SvPVX(RETVAL), bytes, size, RHPR_BASE32);
          265  +	OUTPUT:
          266  +		RETVAL
          267  +
          268  +SV *
          269  +raw2base64(bytes)
          270  +	PROTOTYPE: $
          271  +	PREINIT:
          272  +		STRLEN size;
          273  +	INPUT:
          274  +		unsigned char * bytes = (unsigned char*)SvPV(ST(0), size);
          275  +	CODE:
          276  +		RETVAL = allocate_string_buffer(BASE64_LENGTH(size));
          277  +		rhash_print_bytes(SvPVX(RETVAL), bytes, size, RHPR_BASE64);
          278  +	OUTPUT:
          279  +		RETVAL
          280  +
          281  +# rhash_print_bytes should not be used directly
          282  +#SV *
          283  +#rhash_print_bytes(bytes, flags)
          284  +#	PROTOTYPE: $;$
          285  +#	PREINIT:
          286  +#		STRLEN size;
          287  +#	INPUT:
          288  +#		unsigned char * bytes = SvPV(ST(0), size);
          289  +#		int flags
          290  +#	CODE:
          291  +#		RETVAL = allocate_string_buffer(size * 2);
          292  +#		rhash_print_bytes(SvPVX(RETVAL), bytes, size, flags);
          293  +#	OUTPUT:
          294  +#		RETVAL
          295  +
          296  +#rhash_uptr_t
          297  +#rhash_transmit(msg_id, dst, ldata, rdata)
          298  +#	unsigned msg_id
          299  +#	void * dst
          300  +#	rhash_uptr_t ldata
          301  +#	rhash_uptr_t rdata
          302  +
          303  +##############################################################################
          304  +# BTIH / BitTorrent support functions
          305  +
          306  +void
          307  +rhash_bt_add_filename(ctx, filename, filesize)
          308  +		rhash_context * ctx
          309  +		char * filename
          310  +		ulonglong filesize
          311  +	PROTOTYPE: $$$
          312  +	CODE:
          313  +		rhash_transmit(RMSG_BT_ADD_FILE, ctx, RHASH_STR2UPTR(filename), (rhash_uptr_t)&filesize);
          314  +
          315  +void
          316  +rhash_bt_set_piece_length(ctx, piece_length)
          317  +		rhash_context * ctx
          318  +		unsigned piece_length
          319  +	PROTOTYPE: $$
          320  +	CODE:
          321  +		rhash_transmit(RMSG_BT_SET_PIECE_LENGTH, ctx, RHASH_STR2UPTR(piece_length), 0);
          322  +
          323  +void
          324  +rhash_bt_set_private(ctx)
          325  +		rhash_context * ctx
          326  +	PROTOTYPE: $
          327  +	CODE:
          328  +		rhash_transmit(RMSG_BT_SET_OPTIONS, ctx, RHASH_BT_OPT_PRIVATE, 0);
          329  +
          330  +SV *
          331  +rhash_bt_get_torrent_text(ctx)
          332  +		rhash_context * ctx
          333  +	PROTOTYPE: $
          334  +	PREINIT:
          335  +		size_t len;
          336  +		char *text;
          337  +	CODE:
          338  +		len = rhash_transmit(RMSG_BT_GET_TEXT, ctx, RHASH_STR2UPTR(&text), 0);
          339  +		if(len == RHASH_ERROR) {
          340  +			XSRETURN_UNDEF;
          341  +		}
          342  +		RETVAL = newSVpv(text, len);
          343  +	OUTPUT:
          344  +		RETVAL

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/bindings/perl/t/1test_hash_calculation.t version [fea506a132].

            1  +use Test::More tests => 22;
            2  +BEGIN { use_ok('Crypt::Rhash') };
            3  +
            4  +#########################
            5  +# test script
            6  +
            7  +$msg = "message digest";
            8  +
            9  +ok( $r = new Crypt::Rhash(RHASH_MD5 | RHASH_TTH));
           10  +ok( $r->update($msg) );
           11  +
           12  +is( $r->hash(), "f96b697d7cb7938d525a2f31aaf161d0"); # prints the first hash by default
           13  +is( $r->hash(RHASH_TTH), "ym432msox5qilih2l4tno62e3o35wygwsbsjoba");
           14  +is( $r->hash_hex(RHASH_TTH), "c339bd324ebf6085a0fa5f26d77b44dbb7db60d690649704");
           15  +is( $r->hash_hex(RHASH_MD5), "f96b697d7cb7938d525a2f31aaf161d0");
           16  +is( $r->hash_rhex(RHASH_MD5), "d061f1aa312f5a528d93b77c7d696bf9");
           17  +is( $r->hash_base32(RHASH_MD5), "7fvws7l4w6jy2us2f4y2v4lb2a");
           18  +#is( $r->hash_base64(RHASH_MD5), "+WtpfXy3k41SWi8xqvFh0A=");
           19  +is( $r->hash_raw(RHASH_MD5), "\xf9\x6b\x69\x7d\x7c\xb7\x93\x8d\x52\x5a\x2f\x31\xaa\xf1\x61\xd0");
           20  +is( $r->reset()->hash(), "d41d8cd98f00b204e9800998ecf8427e");
           21  +
           22  +is( $r->hashed_length(), length($msg));
           23  +is( $r->hash_id(), (RHASH_MD5 | RHASH_TTH));
           24  +$r = undef; # destruct the Rhash object
           25  +
           26  +#########################
           27  +# test hashing a file
           28  +
           29  +$file = "msg.txt";
           30  +open FILE, ">$file" or die $!;
           31  +binmode FILE;
           32  +print FILE $msg;
           33  +close FILE;
           34  +
           35  +$r = new Crypt::Rhash(RHASH_MD5);
           36  +is( $r->update_file($file), 14);
           37  +is( $r->hash(), "f96b697d7cb7938d525a2f31aaf161d0");
           38  +#print  "MD5 (\"$msg\") = ". $r->update_file($file)->hash() . "\n";
           39  +
           40  +is( $r->reset()->update_file($file, 4, 1), 1);
           41  +is( $r->hash(), "0cc175b9c0f1b6a831c399e269772661");
           42  +
           43  +open $fd, "<$file" or die $!;
           44  +binmode $fd;
           45  +is( $r->reset()->update_fd($fd), 14);
           46  +is( $r->hash(), "f96b697d7cb7938d525a2f31aaf161d0");
           47  +close $fd;
           48  +unlink($file);
           49  +
           50  +#########################
           51  +# test magnet_link() method
           52  +$r = new Crypt::Rhash(RHASH_ALL);
           53  +$r->update("a")->final();
           54  +is( $r->magnet_link("test.txt", RHASH_MD5 | RHASH_SHA1), "magnet:?xl=1&dn=test.txt&xt=urn:md5:0cc175b9c0f1b6a831c399e269772661&xt=urn:sha1:q336in72uwt7zyk5dxolt2xk5i3xmz5y");
           55  +is( $r->magnet_link(undef, RHASH_ED2K | RHASH_AICH | RHASH_TTH), "magnet:?xl=1&xt=urn:ed2k:bde52cb31de33e46245e05fbdbd6fb24&xt=urn:aich:q336in72uwt7zyk5dxolt2xk5i3xmz5y&xt=urn:tree:tiger:czquwh3iyxbf5l3bgyugzhassmxu647ip2ike4y");
           56  +
           57  +$r = new Crypt::Rhash(RHASH_CRC32 | RHASH_MD4);
           58  +$r->update("abc")->final();
           59  +is( $r->magnet_link(), "magnet:?xl=3&xt=urn:crc32:352441c2&xt=urn:md4:a448017aaf21d8525fc10ae87aa6729d");
           60  +
           61  +__END__

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/bindings/perl/t/2test_static_functions.t version [5e178d3989].

            1  +use Test::More tests => 11;
            2  +use Crypt::Rhash;# qw( :Functions );
            3  +
            4  +#########################
            5  +# Rhash module static functions
            6  +
            7  +ok(RHASH_CRC32 > 0);
            8  +ok(&Crypt::Rhash::count() > 0);
            9  +is(&Crypt::Rhash::get_digest_size(RHASH_CRC32), 4);
           10  +is(&Crypt::Rhash::get_hash_length(RHASH_CRC32), 8);
           11  +is(&Crypt::Rhash::is_base32(RHASH_CRC32), 0);
           12  +is(&Crypt::Rhash::is_base32(RHASH_TTH), 1);
           13  +is(&Crypt::Rhash::get_name(RHASH_CRC32), "CRC32");
           14  +
           15  +# test conversion functions
           16  +is(&raw2hex("test msg"), "74657374206d7367");
           17  +is(&raw2base32("test msg"), "orsxg5banvzwo");
           18  +is(&raw2base64("test msg"), "dGVzdCBtc2c=");
           19  +
           20  +$msg = "message digest";
           21  +
           22  +# test msg() hashing method
           23  +is(&Crypt::Rhash::msg(RHASH_MD5, $msg), "f96b697d7cb7938d525a2f31aaf161d0");

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/bindings/perl/t/3test_all_hash_functions.t version [f7b5928d1d].

            1  +use Test::More tests => 26;
            2  +use Crypt::Rhash;
            3  +
            4  +#########################
            5  +
            6  +$r = new Crypt::Rhash(RHASH_ALL);
            7  +$r->update("a")->final();
            8  +
            9  +is( $r->hash(RHASH_CRC32), "e8b7be43");
           10  +is( $r->hash(RHASH_MD4),   "bde52cb31de33e46245e05fbdbd6fb24");
           11  +is( $r->hash(RHASH_MD5),   "0cc175b9c0f1b6a831c399e269772661");
           12  +is( $r->hash(RHASH_SHA1),  "86f7e437faa5a7fce15d1ddcb9eaeaea377667b8");
           13  +is( $r->hash(RHASH_TIGER), "77befbef2e7ef8ab2ec8f93bf587a7fc613e247f5f247809");
           14  +is( $r->hash(RHASH_TTH),   "czquwh3iyxbf5l3bgyugzhassmxu647ip2ike4y");
           15  +is( length($r->hash(RHASH_BTIH)),  40);
           16  +is( $r->hash(RHASH_ED2K),  "bde52cb31de33e46245e05fbdbd6fb24");
           17  +is( $r->hash(RHASH_AICH),  "q336in72uwt7zyk5dxolt2xk5i3xmz5y");
           18  +is( $r->hash(RHASH_WHIRLPOOL), "8aca2602792aec6f11a67206531fb7d7f0dff59413145e6973c45001d0087b42d11bc645413aeff63a42391a39145a591a92200d560195e53b478584fdae231a");
           19  +is( $r->hash(RHASH_RIPEMD160), "0bdc9d2d256b3ee9daae347be6f4dc835a467ffe");
           20  +is( $r->hash(RHASH_GOST),  "d42c539e367c66e9c88a801f6649349c21871b4344c6a573f849fdce62f314dd");
           21  +is( $r->hash(RHASH_GOST_CRYPTOPRO), "e74c52dd282183bf37af0079c9f78055715a103f17e3133ceff1aacf2f403011");
           22  +is( $r->hash(RHASH_HAS160), "4872bcbc4cd0f0a9dc7c2f7045e5b43b6c830db8");
           23  +is( $r->hash(RHASH_SNEFRU128), "bf5ce540ae51bc50399f96746c5a15bd");
           24  +is( $r->hash(RHASH_SNEFRU256), "45161589ac317be0ceba70db2573ddda6e668a31984b39bf65e4b664b584c63d");
           25  +is( $r->hash(RHASH_SHA224),   "abd37534c7d9a2efb9465de931cd7055ffdb8879563ae98078d6d6d5");
           26  +is( $r->hash(RHASH_SHA256),   "ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb");
           27  +is( $r->hash(RHASH_SHA384),   "54a59b9f22b0b80880d8427e548b7c23abd873486e1f035dce9cd697e85175033caa88e6d57bc35efae0b5afd3145f31");
           28  +is( $r->hash(RHASH_SHA512),   "1f40fc92da241694750979ee6cf582f2d5d7d28e18335de05abc54d0560e0f5302860c652bf08d560252aa5e74210546f369fbbbce8c12cfc7957b2652fe9a75");
           29  +is( $r->hash(RHASH_EDONR256), "943aa9225a2cf154ec2e4dd81237720ba538ca8df2fd83c0b893c5d265f353a0");
           30  +is( $r->hash(RHASH_EDONR512), "b59ec44f7beef8a04ceed38a973d77c65e22e9458d5f67b497948da34986c093b5efc5483fbee55f2f740fcad31f18d80db44bb6b8843e7fd599188e7c07233b");
           31  +is( $r->hash(RHASH_SHA3_224), "9e86ff69557ca95f405f081269685b38e3a819b309ee942f482b6a8b");
           32  +is( $r->hash(RHASH_SHA3_256), "80084bf2fba02475726feb2cab2d8215eab14bc6bdd8bfb2c8151257032ecd8b");
           33  +is( $r->hash(RHASH_SHA3_384), "1815f774f320491b48569efec794d249eeb59aae46d22bf77dafe25c5edc28d7ea44f93ee1234aa88f61c91912a4ccd9");
           34  +is( $r->hash(RHASH_SHA3_512), "697f2d856172cb8309d6b8b97dac4de344b549d4dee61edfb4962d8698b7fa803f4f93ff24393586e28b5b957ac3d1d369420ce53332712f997bd336d09ab02a");
           35  +
           36  +__END__

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/bindings/perl/typemap version [94f499683e].

            1  +rhash_context *					T_PTROBJ
            2  +rhash_uptr_t					T_NV
            3  +ulonglong					T_NV

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/bindings/php/config.m4 version [438875b6aa].

            1  +dnl
            2  +dnl config.m4 for RHash extension
            3  +dnl
            4  +
            5  +PHP_ARG_WITH(rhash, for RHash support,
            6  +[  --with-rhash[=DIR]        Include RHash support.])
            7  +
            8  +if test "$PHP_RHASH" != "no"; then
            9  +  if test -r $PHP_RHASH/include/rhash.h; then
           10  +    RHASH_INCLUDE_DIR=$PHP_RHASH/include
           11  +    RHASH_LIB_DIR=$PHP_RHASH/lib
           12  +  elif test -r $PHP_RHASH/rhash.h; then
           13  +    RHASH_INCLUDE_DIR=$PHP_RHASH
           14  +    RHASH_LIB_DIR=$PHP_RHASH
           15  +  else
           16  +    AC_MSG_CHECKING(for RHash in default path)
           17  +    for i in /usr/local /usr; do
           18  +      if test -r $i/include/rhash.h; then
           19  +        RHASH_INCLUDE_DIR=$i/include
           20  +        RHASH_LIB_DIR=$i/lib
           21  +        AC_MSG_RESULT(found at $i)
           22  +        break
           23  +      fi
           24  +    done
           25  +  fi
           26  +
           27  +  if test -z "$RHASH_INCLUDE_DIR" -a -r ../../librhash/rhash.h; then
           28  +    RHASH_INCLUDE_DIR=$(pwd)/../../librhash
           29  +    RHASH_LIB_DIR=$RHASH_INCLUDE_DIR
           30  +    AC_MSG_RESULT(found at $RHASH_INCLUDE_DIR)
           31  +  fi
           32  +
           33  +  if test -z "$RHASH_INCLUDE_DIR"; then
           34  +    AC_MSG_RESULT(not found)
           35  +    AC_MSG_ERROR(Please reinstall the librhash -
           36  +    rhash.h should be in <rhash-dir>/include/)
           37  +  fi
           38  +
           39  +  AC_DEFINE(HAVE_RHASH, 1, [Whether you have RHash])
           40  +  PHP_ADD_INCLUDE($RHASH_INCLUDE_DIR)
           41  +  PHP_ADD_LIBRARY_WITH_PATH(rhash, $RHASH_LIB_DIR, RHASH_SHARED_LIBADD)
           42  +  PHP_NEW_EXTENSION(rhash, php_rhash.c, $ext_shared)
           43  +  PHP_SUBST(RHASH_SHARED_LIBADD)
           44  +fi

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/bindings/php/php_compatibility.h version [f28d1c341b].

            1  +#ifndef PHP_PORTABLE_H
            2  +#define PHP_PORTABLE_H
            3  +
            4  +#if PHP_MAJOR_VERSION < 7
            5  +
            6  +struct _zend_string {
            7  +	char *val;
            8  +	int len;
            9  +	int persistent;
           10  +};
           11  +typedef struct _zend_string zend_string;
           12  +
           13  +#define RETURN_NEW_STR(s)     RETURN_STRINGL(s->val,s->len,0);
           14  +
           15  +static zend_always_inline zend_string *zend_string_alloc(int len, int persistent)
           16  +{
           17  +	/* aligned to 8 bytes size of buffer to hold (len + 1) characters */
           18  +	int alligned_size = (len + 1 + 7) & ~7;
           19  +	/* single alloc, so free the buf, will also free the struct */
           20  +	char *buf = safe_pemalloc(sizeof(zend_string) + alligned_size, 1, 0, persistent);
           21  +	zend_string *str = (zend_string *)(buf + alligned_size);
           22  +	str->val = buf;
           23  +	str->len = len;
           24  +	str->persistent = persistent;
           25  +	return str;
           26  +}
           27  +
           28  +/* compatibility macros */
           29  +# define _RETURN_STRING(str) RETURN_STRING(str, 1)
           30  +# define _RETURN_STRINGL(str, l) RETURN_STRINGL(str, l, 1)
           31  +typedef long zend_long;
           32  +typedef int strsize_t;
           33  +
           34  +#else
           35  +
           36  +# define _RETURN_STRING(str) RETURN_STRING(str)
           37  +# define _RETURN_STRINGL(str, l) RETURN_STRINGL(str, l)
           38  +typedef size_t strsize_t;
           39  +
           40  +#endif
           41  +
           42  +#endif /* PHP_PORTABLE_H */

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/bindings/php/php_rhash.c version [77d09eda59].

            1  +/* php_rhash.c */
            2  +#ifdef HAVE_CONFIG_H
            3  +#include "config.h"
            4  +#endif
            5  +
            6  +#include <rhash.h>
            7  +#include "php.h"
            8  +#include "php_ini.h"
            9  +#include "ext/standard/info.h"
           10  +#include "php_streams.h"
           11  +#include "php_rhash.h"
           12  +#include "php_compatibility.h"
           13  +
           14  +#define PHP_RHASH_VERSION "1.2.9"
           15  +
           16  +/* {{{ arginfo */
           17  +ZEND_BEGIN_ARG_INFO(arginfo_rhash_count, 0)
           18  +ZEND_END_ARG_INFO()
           19  +
           20  +ZEND_BEGIN_ARG_INFO(arginfo_rhash_get_digest_size, 0)
           21  +	ZEND_ARG_INFO(0, hash_id)
           22  +ZEND_END_ARG_INFO()
           23  +
           24  +ZEND_BEGIN_ARG_INFO(arginfo_rhash_is_base32, 0)
           25  +	ZEND_ARG_INFO(0, hash_id)
           26  +ZEND_END_ARG_INFO()
           27  +
           28  +ZEND_BEGIN_ARG_INFO(arginfo_rhash_get_name, 0)
           29  +	ZEND_ARG_INFO(0, hash_id)
           30  +ZEND_END_ARG_INFO()
           31  +
           32  +ZEND_BEGIN_ARG_INFO(arginfo_rhash_msg, 0)
           33  +	ZEND_ARG_INFO(0, hash_id)
           34  +	ZEND_ARG_INFO(0, message)
           35  +ZEND_END_ARG_INFO()
           36  +
           37  +ZEND_BEGIN_ARG_INFO(arginfo_rhash_file, 0)
           38  +	ZEND_ARG_INFO(0, hash_id)
           39  +	ZEND_ARG_INFO(0, path)
           40  +ZEND_END_ARG_INFO()
           41  +
           42  +ZEND_BEGIN_ARG_INFO(arginfo_rhash_magnet_func, 0)
           43  +	ZEND_ARG_INFO(0, hash_id)
           44  +	ZEND_ARG_INFO(0, path)
           45  +ZEND_END_ARG_INFO()
           46  +/* }}} */
           47  +
           48  +/* {{{ The table of global functions
           49  +*/
           50  +static zend_function_entry rhash_functions[] = {
           51  +	PHP_FE(rhash_count, arginfo_rhash_count)
           52  +	PHP_FE(rhash_get_digest_size, arginfo_rhash_get_digest_size)
           53  +	PHP_FE(rhash_is_base32, arginfo_rhash_is_base32)
           54  +	PHP_FE(rhash_get_name, arginfo_rhash_get_name)
           55  +	PHP_FE(rhash_msg, arginfo_rhash_msg)
           56  +	PHP_FE(rhash_file, arginfo_rhash_file)
           57  +	PHP_FE(rhash_magnet, arginfo_rhash_magnet_func)
           58  +	PHP_FE_END
           59  +};
           60  +/* }}} */
           61  +
           62  +
           63  +/* {{{ arginfo */
           64  +ZEND_BEGIN_ARG_INFO_EX(arginfo_rhash__construct, 0, 0, 0)
           65  +	ZEND_ARG_INFO(0, hash_id)
           66  +ZEND_END_ARG_INFO()
           67  +
           68  +ZEND_BEGIN_ARG_INFO(arginfo_rhash_update, 0)
           69  +	ZEND_ARG_INFO(0, message)
           70  +ZEND_END_ARG_INFO()
           71  +
           72  +ZEND_BEGIN_ARG_INFO_EX(arginfo_rhash_update_stream, 0, 0, 1)
           73  +	ZEND_ARG_INFO(0, handle)
           74  +	ZEND_ARG_INFO(0, start)
           75  +	ZEND_ARG_INFO(0, size)
           76  +ZEND_END_ARG_INFO()
           77  +
           78  +ZEND_BEGIN_ARG_INFO_EX(arginfo_rhash_update_file, 0, 0, 1)
           79  +	ZEND_ARG_INFO(0, path)
           80  +	ZEND_ARG_INFO(0, start)
           81  +	ZEND_ARG_INFO(0, size)
           82  +ZEND_END_ARG_INFO()
           83  +
           84  +ZEND_BEGIN_ARG_INFO(arginfo_rhash_final, 0)
           85  +ZEND_END_ARG_INFO()
           86  +
           87  +ZEND_BEGIN_ARG_INFO(arginfo_rhash_reset, 0)
           88  +ZEND_END_ARG_INFO()
           89  +
           90  +ZEND_BEGIN_ARG_INFO(arginfo_rhash_hashed_length, 0)
           91  +ZEND_END_ARG_INFO()
           92  +
           93  +ZEND_BEGIN_ARG_INFO_EX(arginfo_rhash_hash, 0, 0, 0)
           94  +	ZEND_ARG_INFO(0, hash_id)
           95  +ZEND_END_ARG_INFO()
           96  +
           97  +ZEND_BEGIN_ARG_INFO_EX(arginfo_rhash_raw, 0, 0, 0)
           98  +	ZEND_ARG_INFO(0, hash_id)
           99  +ZEND_END_ARG_INFO()
          100  +
          101  +ZEND_BEGIN_ARG_INFO_EX(arginfo_rhash_hex, 0, 0, 0)
          102  +	ZEND_ARG_INFO(0, hash_id)
          103  +ZEND_END_ARG_INFO()
          104  +
          105  +ZEND_BEGIN_ARG_INFO_EX(arginfo_rhash_base32, 0, 0, 0)
          106  +	ZEND_ARG_INFO(0, hash_id)
          107  +ZEND_END_ARG_INFO()
          108  +
          109  +ZEND_BEGIN_ARG_INFO_EX(arginfo_rhash_base64, 0, 0, 0)
          110  +	ZEND_ARG_INFO(0, hash_id)
          111  +ZEND_END_ARG_INFO()
          112  +
          113  +ZEND_BEGIN_ARG_INFO_EX(arginfo_rhash_magnet, 0, 0, 0)
          114  +	ZEND_ARG_INFO(0, filename)
          115  +ZEND_END_ARG_INFO()
          116  +/* }}} */
          117  +
          118  +/* {{{ The table of the RHash class methods
          119  +*/
          120  +zend_function_entry rhash_methods[] = {
          121  +	PHP_ME(RHash,  __construct,     arginfo_rhash__construct, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
          122  +	PHP_ME(RHash,  update,          arginfo_rhash_update, ZEND_ACC_PUBLIC)
          123  +	PHP_ME(RHash,  update_stream,   arginfo_rhash_update_stream, ZEND_ACC_PUBLIC)
          124  +	PHP_ME(RHash,  update_file,     arginfo_rhash_update_file, ZEND_ACC_PUBLIC)
          125  +	PHP_ME(RHash,  final,           arginfo_rhash_final, ZEND_ACC_PUBLIC)
          126  +	PHP_ME(RHash,  reset,           arginfo_rhash_reset, ZEND_ACC_PUBLIC)
          127  +	PHP_ME(RHash,  hashed_length,   arginfo_rhash_hashed_length, ZEND_ACC_PUBLIC)
          128  +	PHP_ME(RHash,  hash,            arginfo_rhash_hash, ZEND_ACC_PUBLIC)
          129  +	PHP_ME(RHash,  raw,             arginfo_rhash_raw, ZEND_ACC_PUBLIC)
          130  +	PHP_ME(RHash,  hex,             arginfo_rhash_hex, ZEND_ACC_PUBLIC)
          131  +	PHP_ME(RHash,  base32,          arginfo_rhash_base32, ZEND_ACC_PUBLIC)
          132  +	PHP_ME(RHash,  base64,          arginfo_rhash_base64, ZEND_ACC_PUBLIC)
          133  +	PHP_ME(RHash,  magnet,          arginfo_rhash_magnet, ZEND_ACC_PUBLIC)
          134  +	PHP_FE_END
          135  +};
          136  +/* }}} */
          137  +
          138  +zend_class_entry *rhash_ce;
          139  +zend_object_handlers rhash_object_handlers;
          140  +
          141  +/* {{{ Module struct
          142  +*/
          143  +zend_module_entry rhash_module_entry = {
          144  +#if ZEND_MODULE_API_NO >= 20010901
          145  +	STANDARD_MODULE_HEADER,
          146  +#endif
          147  +	"rhash",                   /* extension name */
          148  +	rhash_functions,           /* function list */
          149  +	PHP_MINIT(rhash),          /* process startup */
          150  +	PHP_MSHUTDOWN(rhash),      /* process shutdown */
          151  +	NULL,
          152  +	NULL,
          153  +	PHP_MINFO(rhash),          /* extension info */
          154  +#if ZEND_MODULE_API_NO >= 20010901
          155  +	PHP_RHASH_VERSION,         /* extension version */
          156  +#endif
          157  +	STANDARD_MODULE_PROPERTIES
          158  +};
          159  +/* }}} */
          160  +
          161  +#ifdef COMPILE_DL_RHASH
          162  +ZEND_GET_MODULE(rhash)
          163  +#endif
          164  +
          165  +#define REGISTER_RHASH_CONSTANT(c) REGISTER_LONG_CONSTANT(#c, c, CONST_CS | CONST_PERSISTENT)
          166  +#define RHASH_ALL RHASH_ALL_HASHES
          167  +
          168  +
          169  +#if PHP_MAJOR_VERSION < 7
          170  +typedef struct _rhash_object {
          171  +	zend_object     zobj;
          172  +	rhash           rhash;
          173  +} rhash_object;
          174  +
          175  +# define get_rhash_object(this_zval) ((rhash_object*)zend_object_store_get_object(this_zval TSRMLS_CC))
          176  +# define get_rhash_object_from_zend_object(object) (rhash_object *)(object)
          177  +#else
          178  +typedef struct _rhash_object {
          179  +	rhash           rhash;
          180  +	zend_object     zobj;
          181  +} rhash_object;
          182  +
          183  +static rhash_object * get_rhash_object(zval *this_zval)
          184  +{
          185  +	zend_object *zobj = Z_OBJ_P(this_zval);
          186  +	return (rhash_object *)((char *)zobj - XtOffsetOf(rhash_object, zobj));
          187  +}
          188  +# define get_rhash_object_from_zend_object(object) (rhash_object *)((char *)object - XtOffsetOf(rhash_object, zobj));
          189  +#endif
          190  +
          191  +static void rhash_free_object(zend_object *object TSRMLS_DC)
          192  +{
          193  +	rhash_object *obj = get_rhash_object_from_zend_object(object);
          194  +	if (obj->rhash)
          195  +		rhash_free(obj->rhash);
          196  +
          197  +	/* call Zend's free handler, which will free object properties */
          198  +	zend_object_std_dtor(object TSRMLS_CC);
          199  +#if PHP_MAJOR_VERSION < 7
          200  +	efree(object);
          201  +#endif
          202  +}
          203  +
          204  +/* Allocate memory for new rhash_object */
          205  +#if PHP_MAJOR_VERSION < 7
          206  +static zend_object_value rhash_create_object(zend_class_entry *ce TSRMLS_DC)
          207  +{
          208  +	zend_object_value retval;
          209  +
          210  +	rhash_object *obj = (rhash_object *)emalloc(sizeof(rhash_object));
          211  +	memset(obj, 0, sizeof(rhash_object));
          212  +	zend_object_std_init(&obj->zobj, ce TSRMLS_CC);
          213  +	obj->rhash = NULL;
          214  +
          215  +	/* call object_properties_init(), because extending classes may use properties. */
          216  +	object_properties_init(&obj->zobj, ce);
          217  +
          218  +	retval.handle = zend_objects_store_put(obj,
          219  +		(zend_objects_store_dtor_t) zend_objects_destroy_object,
          220  +		(zend_objects_free_object_storage_t)rhash_free_object, NULL TSRMLS_CC);
          221  +	retval.handlers = &rhash_object_handlers;
          222  +	return retval;
          223  +}
          224  +#else
          225  +static zend_object *rhash_create_object(zend_class_entry *ce TSRMLS_DC)
          226  +{
          227  +	rhash_object *obj = ecalloc(1, sizeof(*obj) + zend_object_properties_size(ce));
          228  +	zend_object_std_init(&obj->zobj, ce TSRMLS_CC);
          229  +
          230  +	obj->zobj.handlers = &rhash_object_handlers;
          231  +	return &obj->zobj;
          232  +}
          233  +#endif
          234  +
          235  +/* {{{ PHP_MINIT_FUNCTION(rhash) */
          236  +PHP_MINIT_FUNCTION(rhash)
          237  +{
          238  +	zend_class_entry ce;
          239  +	rhash_library_init(); /* initialize LibRHash */
          240  +
          241  +	/* register RHash class, its methods and handlers */
          242  +	INIT_CLASS_ENTRY(ce, "RHash", rhash_methods);
          243  +	rhash_ce = zend_register_internal_class(&ce TSRMLS_CC);
          244  +	rhash_ce->create_object = rhash_create_object;
          245  +
          246  +	memcpy(&rhash_object_handlers,
          247  +		zend_get_std_object_handlers(), sizeof(zend_object_handlers));
          248  +	rhash_object_handlers.clone_obj = NULL;
          249  +#if PHP_MAJOR_VERSION >= 7
          250  +	rhash_object_handlers.free_obj = rhash_free_object; /* This is the free handler */
          251  +	rhash_object_handlers.offset   = XtOffsetOf(rhash_object, zobj);
          252  +#endif
          253  +
          254  +	REGISTER_RHASH_CONSTANT(RHASH_CRC32);
          255  +	REGISTER_RHASH_CONSTANT(RHASH_MD4);
          256  +	REGISTER_RHASH_CONSTANT(RHASH_MD5);
          257  +	REGISTER_RHASH_CONSTANT(RHASH_SHA1);
          258  +	REGISTER_RHASH_CONSTANT(RHASH_TIGER);
          259  +	REGISTER_RHASH_CONSTANT(RHASH_TTH);
          260  +	REGISTER_RHASH_CONSTANT(RHASH_BTIH);
          261  +	REGISTER_RHASH_CONSTANT(RHASH_ED2K);
          262  +	REGISTER_RHASH_CONSTANT(RHASH_AICH);
          263  +	REGISTER_RHASH_CONSTANT(RHASH_WHIRLPOOL);
          264  +	REGISTER_RHASH_CONSTANT(RHASH_RIPEMD160);
          265  +	REGISTER_RHASH_CONSTANT(RHASH_GOST);
          266  +	REGISTER_RHASH_CONSTANT(RHASH_GOST_CRYPTOPRO);
          267  +	REGISTER_RHASH_CONSTANT(RHASH_HAS160);
          268  +	REGISTER_RHASH_CONSTANT(RHASH_SNEFRU128);
          269  +	REGISTER_RHASH_CONSTANT(RHASH_SNEFRU256);
          270  +	REGISTER_RHASH_CONSTANT(RHASH_SHA224);
          271  +	REGISTER_RHASH_CONSTANT(RHASH_SHA256);
          272  +	REGISTER_RHASH_CONSTANT(RHASH_SHA384);
          273  +	REGISTER_RHASH_CONSTANT(RHASH_SHA512);
          274  +	REGISTER_RHASH_CONSTANT(RHASH_EDONR256);
          275  +	REGISTER_RHASH_CONSTANT(RHASH_EDONR512);
          276  +	REGISTER_RHASH_CONSTANT(RHASH_SHA3_224);
          277  +	REGISTER_RHASH_CONSTANT(RHASH_SHA3_256);
          278  +	REGISTER_RHASH_CONSTANT(RHASH_SHA3_384);
          279  +	REGISTER_RHASH_CONSTANT(RHASH_SHA3_512);
          280  +	REGISTER_RHASH_CONSTANT(RHASH_ALL);
          281  +
          282  +	return SUCCESS;
          283  +}
          284  +/* }}} */
          285  +
          286  +/* {{{ PHP_MSHUTDOWN_FUNCTION(rhash) */
          287  +PHP_MSHUTDOWN_FUNCTION(rhash)
          288  +{
          289  +	return SUCCESS;
          290  +}
          291  +/* }}} */
          292  +
          293  +/* {{{ PHP_MINFO_FUNCTION(rhash) */
          294  +PHP_MINFO_FUNCTION(rhash)
          295  +{
          296  +	php_info_print_table_start();
          297  +	php_info_print_table_row(2, "rhash support", "enabled");
          298  +	php_info_print_table_end();
          299  +}
          300  +/* }}} */
          301  +
          302  +/* Global functions */
          303  +
          304  +/* {{{ proto int rhash_count()
          305  +   Returns the number of supported hash functions */
          306  +PHP_FUNCTION(rhash_count) {
          307  +	RETURN_LONG(rhash_count());
          308  +}
          309  +/* }}} */
          310  +
          311  +/* {{{ proto int rhash_get_digest_size(int hash_id)
          312  +   Returns the size in bytes of message digest of the specified hash function */
          313  +PHP_FUNCTION(rhash_get_digest_size) {
          314  +	zend_long hash_id;
          315  +
          316  +	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &hash_id) == FAILURE) {
          317  +		RETURN_FALSE;
          318  +	}
          319  +	RETURN_LONG(rhash_get_digest_size((unsigned)hash_id));
          320  +}
          321  +/* }}} */
          322  +
          323  +/* {{{ proto boolean rhash_is_base32(int hash_id)
          324  +   Returns true if default format of message digest is base32 and false if it's hexadecimal */
          325  +PHP_FUNCTION(rhash_is_base32) {
          326  +	zend_long hash_id;
          327  +
          328  +	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &hash_id) == FAILURE) {
          329  +		RETURN_FALSE;
          330  +	}
          331  +	RETURN_BOOL(rhash_is_base32((unsigned)hash_id));
          332  +}
          333  +/* }}} */
          334  +
          335  +/* {{{ proto string rhash_get_name(int hash_id)
          336  +   Returns the name of the specified hash function */
          337  +PHP_FUNCTION(rhash_get_name) {
          338  +	zend_long hash_id;
          339  +
          340  +	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &hash_id) == FAILURE) {
          341  +		RETURN_FALSE;
          342  +	}
          343  +	_RETURN_STRING(rhash_get_name((unsigned)hash_id));
          344  +}
          345  +/* }}} */
          346  +
          347  +/* {{{ proto string rhash_msg(int hash_id, string message)
          348  +   Returns message digest for the message string */
          349  +PHP_FUNCTION(rhash_msg) {
          350  +	zend_long hash_id;
          351  +	char *s;
          352  +	strsize_t s_len;
          353  +	strsize_t length;
          354  +	rhash context = NULL;
          355  +	char buffer[130];
          356  +
          357  +	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &hash_id, &s, &s_len) == FAILURE) {
          358  +		RETURN_NULL();
          359  +	}
          360  +
          361  +	if (!(context = rhash_init((unsigned)hash_id))) {
          362  +		RETURN_NULL();
          363  +	}
          364  +
          365  +	rhash_update(context, s, s_len);
          366  +	rhash_final(context, 0);
          367  +	length = rhash_print(buffer, context, (unsigned)hash_id, 0);
          368  +	rhash_free(context);
          369  +	_RETURN_STRINGL(buffer, length);
          370  +}
          371  +
          372  +/* Calculate hash for a php stream. Returns SUCCESS or FAILURE. */
          373  +static strsize_t _php_rhash_stream(INTERNAL_FUNCTION_PARAMETERS, rhash context, php_stream *stream, zend_long start, zend_long size)
          374  +{
          375  +	char data[8192];
          376  +	if (context == NULL) {
          377  +		rhash_object *obj = get_rhash_object(getThis());
          378  +		if ((context = obj->rhash) == NULL) return FAILURE;
          379  +	}
          380  +
          381  +	if (start >= 0) {
          382  +		if (php_stream_seek(stream, start, SEEK_SET) < 0) return FAILURE;
          383  +	}
          384  +
          385  +	if (size >= 0) {
          386  +		while (size > 0 && !php_stream_eof(stream)) {
          387  +			int length = php_stream_read(stream, data, (size < 8192 ? size : 8192));
          388  +			if (!length) return FAILURE;
          389  +			size -= length;
          390  +			rhash_update(context, data, length);
          391  +		}
          392  +	} else {
          393  +		while (!php_stream_eof(stream)) {
          394  +			int length = php_stream_read(stream, data, 8192);
          395  +			if (!length) return FAILURE;
          396  +			rhash_update(context, data, length);
          397  +		}
          398  +	}
          399  +	return SUCCESS;
          400  +}
          401  +/* }}} */
          402  +
          403  +/* Calculate hash of the given file or its part. Returns SUCCESS or FAILURE. */
          404  +static strsize_t _php_rhash_file(INTERNAL_FUNCTION_PARAMETERS, rhash context, char* path, zend_long start, zend_long size)
          405  +{
          406  +	strsize_t res;
          407  +	php_stream *stream = php_stream_open_wrapper(path, "rb", 0, 0);
          408  +	if (stream == NULL) return FAILURE;
          409  +
          410  +	res = _php_rhash_stream(INTERNAL_FUNCTION_PARAM_PASSTHRU, context, stream, start, size);
          411  +	php_stream_close(stream);
          412  +	return res;
          413  +}
          414  +/* }}} */
          415  +
          416  +/* {{{ proto string rhash_file(int hash_id, string path)
          417  +   Computes and returns message digest for a file. Returns NULL on failure. */
          418  +PHP_FUNCTION(rhash_file) {
          419  +	zend_long hash_id = 0;
          420  +	char *path;
          421  +	strsize_t path_len;
          422  +	rhash context = NULL;
          423  +	char buffer[130];
          424  +	int buffer_length;
          425  +	strsize_t res;
          426  +
          427  +	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lp", &hash_id, &path, &path_len) == FAILURE) {
          428  +		RETURN_NULL();
          429  +	}
          430  +	if (!hash_id || !(context = rhash_init(hash_id))) {
          431  +		RETURN_NULL()
          432  +	}
          433  +	res = _php_rhash_file(INTERNAL_FUNCTION_PARAM_PASSTHRU, context, path, -1, -1);
          434  +	rhash_final(context, 0);
          435  +	buffer_length = rhash_print(buffer, context, hash_id, 0);
          436  +	rhash_free(context);
          437  +
          438  +	/* return NULL on failure */
          439  +	if (res != SUCCESS) {
          440  +		RETURN_NULL();
          441  +	}
          442  +	_RETURN_STRINGL(buffer, buffer_length);
          443  +}
          444  +/* }}} */
          445  +
          446  +/* {{{ proto string rhash_magnet(int hash_id, string path)
          447  +   Computes and returns magnet link for a file. Returns NULL on failure. */
          448  +PHP_FUNCTION(rhash_magnet) {
          449  +	zend_long hash_id = 0;
          450  +	char *path;
          451  +	strsize_t path_len;
          452  +	rhash context = NULL;
          453  +	zend_string* str;
          454  +	size_t buffer_size;
          455  +	strsize_t res;
          456  +
          457  +	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lp", &hash_id, &path, &path_len) == FAILURE) {
          458  +		RETURN_NULL();
          459  +	}
          460  +	if (!hash_id || !(context = rhash_init(hash_id))) {
          461  +		RETURN_NULL();
          462  +	}
          463  +	res = _php_rhash_file(INTERNAL_FUNCTION_PARAM_PASSTHRU, context, path, -1, -1);
          464  +	if (res != SUCCESS) RETURN_NULL();
          465  +	rhash_final(context, 0);
          466  +
          467  +	buffer_size = rhash_print_magnet(0, path, context, hash_id, RHPR_FILESIZE);
          468  +
          469  +	str = zend_string_alloc(buffer_size - 1, 0);
          470  +	if (!str) {
          471  +		rhash_free(context);
          472  +		RETURN_NULL();
          473  +	}
          474  +
          475  +	rhash_print_magnet(str->val, path, context, hash_id, RHPR_FILESIZE);
          476  +	rhash_free(context);
          477  +	RETURN_NEW_STR(str);
          478  +}
          479  +/* }}} */
          480  +
          481  +
          482  +/* RHash class methods */
          483  +
          484  +/* {{{ proto RHash::__construct([int hash_id])
          485  +   Creates new RHash object */
          486  +PHP_METHOD(RHash, __construct)
          487  +{
          488  +	zend_long hash_id = 0;
          489  +	rhash context = NULL;
          490  +	rhash_object *obj;
          491  +
          492  +	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &hash_id) == FAILURE) {
          493  +		RETURN_NULL();
          494  +	}
          495  +	if (!hash_id)
          496  +		hash_id = RHASH_ALL_HASHES;
          497  +	if (!(context = rhash_init(hash_id))) {
          498  +		RETURN_NULL();
          499  +	}
          500  +	rhash_set_autofinal(context, 0);
          501  +	obj = get_rhash_object(getThis());
          502  +	obj->rhash = context;
          503  +}
          504  +/* }}} */
          505  +
          506  +/* {{{ proto RHash RHash::update(string message)
          507  +   Updates RHash object with new data chunk and returns $this */
          508  +PHP_METHOD(RHash, update)
          509  +{
          510  +	char *s;
          511  +	strsize_t s_len;
          512  +	zval *object = getThis();
          513  +	rhash_object *obj =  get_rhash_object(object);
          514  +	
          515  +	if (obj->rhash == NULL ||
          516  +		zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &s, &s_len) == FAILURE) {
          517  +		RETURN_FALSE;
          518  +	}
          519  +	rhash_update(obj->rhash, s, s_len);
          520  +	Z_ADDREF(*object);
          521  +	*return_value = *object;
          522  +}
          523  +/* }}} */
          524  +
          525  +/* {{{ proto boolean RHash::update_stream(resource handle[, int start[, int size]])
          526  +   Returns true if successfully calculated hashes for a (part of) stream, false on error */
          527  +PHP_METHOD(RHash, update_stream)
          528  +{
          529  +	zval *handle;
          530  +	strsize_t res;
          531  +	zend_long start = -1, size = -1;
          532  +	php_stream *stream;
          533  +	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|ll", &handle, &start, &size) == FAILURE) {
          534  +		RETURN_FALSE;
          535  +	}
          536  +#if PHP_MAJOR_VERSION < 7
          537  +	php_stream_from_zval_no_verify(stream, &handle);
          538  +#else
          539  +	php_stream_from_zval_no_verify(stream, handle);
          540  +#endif
          541  +	if (stream == NULL) RETURN_FALSE;
          542  +	res = _php_rhash_stream(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0, stream, start, size);
          543  +	RETURN_BOOL(res == SUCCESS);
          544  +}
          545  +/* }}} */
          546  +
          547  +/* {{{ proto boolean RHash::update_file(string path[, int start[, int size]])
          548  +   Returns true if successfully calculated hashes for a (part of) file, false on error */
          549  +PHP_METHOD(RHash, update_file)
          550  +{
          551  +	char *path;
          552  +	strsize_t len;
          553  +	zend_long start = -1, size = -1;
          554  +	strsize_t res = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|ll", &path, &len, &start, &size);
          555  +	if (res == SUCCESS) {
          556  +		res = _php_rhash_file(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0, path, start, size);
          557  +	}
          558  +	RETURN_BOOL(res == SUCCESS);
          559  +}
          560  +/* }}} */
          561  +
          562  +/* {{{ proto RHash RHash::final()
          563  +   Finalizes calculation for all hashed data and returns $this */
          564  +PHP_METHOD(RHash, final)
          565  +{
          566  +	zval *object = getThis();
          567  +	rhash_object *obj = get_rhash_object(object);
          568  +	if (obj->rhash == NULL) RETURN_FALSE;
          569  +	rhash_final(obj->rhash, NULL);
          570  +	Z_ADDREF(*object);
          571  +	*return_value = *object;
          572  +}
          573  +/* }}} */
          574  +
          575  +/* {{{ proto RHash RHash::reset()
          576  +   Resets RHash object to initial state and returns $this */
          577  +PHP_METHOD(RHash, reset)
          578  +{
          579  +	zval *object = getThis();
          580  +	rhash_object *obj = get_rhash_object(object);
          581  +	if (obj->rhash == NULL) RETURN_FALSE;
          582  +	rhash_reset(obj->rhash);
          583  +	Z_ADDREF(*object);
          584  +	*return_value = *object;
          585  +}
          586  +/* }}} */
          587  +
          588  +/* {{{ proto int RHash::hashed_length()
          589  +   Returns length in bytes of the hashed data */
          590  +PHP_METHOD(RHash, hashed_length)
          591  +{
          592  +	rhash_object *obj = get_rhash_object(getThis());
          593  +	if (obj->rhash == NULL) RETURN_FALSE;
          594  +	RETURN_LONG((long)obj->rhash->msg_size);
          595  +}
          596  +/* }}} */
          597  +
          598  +/* {{{ _php_get_hash(RHash this_class[, int hash_id], int print_flags)
          599  +   Returns calculated hash in the specified format */
          600  +static void _php_get_hash(INTERNAL_FUNCTION_PARAMETERS, int print_flags)
          601  +{
          602  +	zend_long hash_id = 0;
          603  +	char buffer[130];
          604  +	int length;
          605  +	rhash_object *obj = get_rhash_object(getThis());
          606  +	if (obj->rhash == NULL ||
          607  +		zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &hash_id) == FAILURE) {
          608  +		RETURN_FALSE;
          609  +	}
          610  +	length = rhash_print(buffer, obj->rhash, hash_id, print_flags);
          611  +	_RETURN_STRINGL(buffer, length)
          612  +}
          613  +/* }}} */
          614  +
          615  +/* {{{ proto string RHash::hash([int hash_id])
          616  +   Returns hash value in default format */
          617  +PHP_METHOD(RHash, hash)
          618  +{
          619  +	_php_get_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
          620  +}
          621  +/* }}} */
          622  +
          623  +/* {{{ proto string RHash::raw([int hash_id])
          624  +   Returns hash value as raw bytes */
          625  +PHP_METHOD(RHash, raw)
          626  +{
          627  +	_php_get_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, RHPR_RAW);
          628  +}
          629  +/* }}} */
          630  +
          631  +/* {{{ proto string RHash::hex([int hash_id])
          632  +   Returns hash value as hexadecimal string */
          633  +PHP_METHOD(RHash, hex)
          634  +{
          635  +	_php_get_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, RHPR_HEX);
          636  +}
          637  +/* }}} */
          638  +
          639  +/* {{{ proto string RHash::base32([int hash_id])
          640  +   Returns hash value as base32 string */
          641  +PHP_METHOD(RHash, base32)
          642  +{
          643  +	_php_get_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, RHPR_BASE32);
          644  +}
          645  +/* }}} */
          646  +
          647  +/* {{{ proto string RHash::base64([int hash_id])
          648  +   Returns hash value as base64 string */
          649  +PHP_METHOD(RHash, base64)
          650  +{
          651  +	_php_get_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, RHPR_BASE64);
          652  +}
          653  +/* }}} */
          654  +
          655  +/* {{{ proto string RHash::magnet([string filename])
          656  +   Returns magnet link with all hashes computed by the RHash object */
          657  +PHP_METHOD(RHash, magnet)
          658  +{
          659  +	char *s = 0;
          660  +	strsize_t s_len;
          661  +	size_t buf_size;
          662  +	zend_string *magnet_str;
          663  +	rhash_object *obj = get_rhash_object(getThis());
          664  +
          665  +	if (obj->rhash == NULL ||
          666  +		zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &s, &s_len) == FAILURE) {
          667  +		RETURN_FALSE;
          668  +	}
          669  +
          670  +	buf_size = rhash_print_magnet(0, s, obj->rhash, RHASH_ALL_HASHES, RHPR_FILESIZE);
          671  +	magnet_str = zend_string_alloc(buf_size - 1, 0);
          672  +	if (!magnet_str) RETURN_FALSE;
          673  +
          674  +	rhash_print_magnet(magnet_str->val, s, obj->rhash, RHASH_ALL_HASHES, RHPR_FILESIZE);
          675  +	RETURN_NEW_STR(magnet_str);
          676  +}
          677  +/* }}} */

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/bindings/php/php_rhash.h version [25c2c28792].

            1  +#ifndef PHP_RHASH_H
            2  +#define PHP_RHASH_H
            3  +
            4  +extern zend_module_entry rhash_module_entry;
            5  +#define phpext_rhash_ptr &rhash_module_entry
            6  +
            7  +PHP_MINIT_FUNCTION(rhash);
            8  +PHP_MSHUTDOWN_FUNCTION(rhash);
            9  +PHP_MINFO_FUNCTION(rhash);
           10  +
           11  +PHP_FUNCTION(rhash_count);
           12  +PHP_FUNCTION(rhash_get_digest_size);
           13  +PHP_FUNCTION(rhash_get_name);
           14  +PHP_FUNCTION(rhash_is_base32);
           15  +PHP_FUNCTION(rhash_msg);
           16  +PHP_FUNCTION(rhash_file);
           17  +PHP_FUNCTION(rhash_magnet);
           18  +
           19  +PHP_METHOD(RHash, __construct);
           20  +PHP_METHOD(RHash, update);
           21  +PHP_METHOD(RHash, update_stream);
           22  +PHP_METHOD(RHash, update_file);
           23  +PHP_METHOD(RHash, final);
           24  +PHP_METHOD(RHash, reset);
           25  +PHP_METHOD(RHash, hashed_length);
           26  +
           27  +PHP_METHOD(RHash, hash);
           28  +PHP_METHOD(RHash, raw);
           29  +PHP_METHOD(RHash, hex);
           30  +PHP_METHOD(RHash, base32);
           31  +PHP_METHOD(RHash, base64);
           32  +PHP_METHOD(RHash, magnet);
           33  +
           34  +#endif /* PHP_RHASH_H */

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/bindings/php/tests/001.phpt version [847b829847].

            1  +--TEST--
            2  +test RHash global functions
            3  +--FILE--
            4  +<?php
            5  +echo (rhash_count() >= 26) . "\n";
            6  +echo rhash_get_digest_size(RHASH_CRC32) . "\n";
            7  +echo (int)rhash_is_base32(RHASH_MD5) . "\n";
            8  +echo (int)rhash_is_base32(RHASH_AICH) . "\n";
            9  +echo rhash_get_name(RHASH_SHA1) . "\n";
           10  +echo rhash_msg(RHASH_TTH, 'abc') . "\n";
           11  +echo "Done\n";
           12  +?>
           13  +--EXPECTF--
           14  +1
           15  +4
           16  +0
           17  +1
           18  +SHA1
           19  +asd4ujseh5m47pdyb46kbtsqtsgdklbhyxomuia
           20  +Done

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/bindings/php/tests/002.phpt version [facd746bfa].

            1  +--TEST--
            2  +test RHash basic  methods
            3  +--FILE--
            4  +<?php
            5  +$r = new RHash();
            6  +$r->update('a')->final();
            7  +echo $r->hashed_length() . "\n";
            8  +
            9  +echo $r->hash(RHASH_CRC32) . "\n";
           10  +echo $r->hash(RHASH_MD4) . "\n";
           11  +echo $r->hash(RHASH_MD5) . "\n";
           12  +echo $r->hash(RHASH_SHA1) . "\n";
           13  +echo $r->hash(RHASH_TIGER) . "\n";
           14  +echo $r->hash(RHASH_TTH) . "\n";
           15  +echo strlen($r->hash(RHASH_BTIH)) . "\n";
           16  +echo $r->hash(RHASH_ED2K) . "\n";
           17  +echo $r->hash(RHASH_AICH) . "\n";
           18  +echo $r->hash(RHASH_WHIRLPOOL) . "\n";
           19  +echo $r->hash(RHASH_RIPEMD160) . "\n";
           20  +echo $r->hash(RHASH_GOST) . "\n";
           21  +echo $r->hash(RHASH_GOST_CRYPTOPRO) . "\n";
           22  +echo $r->hash(RHASH_HAS160) . "\n";
           23  +echo $r->hash(RHASH_SNEFRU128) . "\n";
           24  +echo $r->hash(RHASH_SNEFRU256) . "\n";
           25  +echo $r->hash(RHASH_SHA224) . "\n";
           26  +echo $r->hash(RHASH_SHA256) . "\n";
           27  +echo $r->hash(RHASH_SHA384) . "\n";
           28  +echo $r->hash(RHASH_SHA512) . "\n";
           29  +echo $r->hash(RHASH_SHA3_224) . "\n";
           30  +echo $r->hash(RHASH_SHA3_256) . "\n";
           31  +echo $r->hash(RHASH_SHA3_384) . "\n";
           32  +echo $r->hash(RHASH_SHA3_512) . "\n";
           33  +echo $r->hash(RHASH_EDONR256) . "\n";
           34  +echo $r->hash(RHASH_EDONR512) . "\n";
           35  +echo $r->raw(RHASH_SHA1) . "\n";
           36  +echo $r->hex(RHASH_TTH) . "\n";
           37  +echo $r->base32(RHASH_SHA1) . "\n";
           38  +echo $r->base64(RHASH_SHA1) . "\n";
           39  +$r = new RHash(RHASH_CRC32 | RHASH_AICH);
           40  +echo $r->update('a')->final()->magnet('file.txt') . "\n";
           41  +echo "Done\n";
           42  +?>
           43  +--EXPECTF--
           44  +1
           45  +e8b7be43
           46  +bde52cb31de33e46245e05fbdbd6fb24
           47  +0cc175b9c0f1b6a831c399e269772661
           48  +86f7e437faa5a7fce15d1ddcb9eaeaea377667b8
           49  +77befbef2e7ef8ab2ec8f93bf587a7fc613e247f5f247809
           50  +czquwh3iyxbf5l3bgyugzhassmxu647ip2ike4y
           51  +40
           52  +bde52cb31de33e46245e05fbdbd6fb24
           53  +q336in72uwt7zyk5dxolt2xk5i3xmz5y
           54  +8aca2602792aec6f11a67206531fb7d7f0dff59413145e6973c45001d0087b42d11bc645413aeff63a42391a39145a591a92200d560195e53b478584fdae231a
           55  +0bdc9d2d256b3ee9daae347be6f4dc835a467ffe
           56  +d42c539e367c66e9c88a801f6649349c21871b4344c6a573f849fdce62f314dd
           57  +e74c52dd282183bf37af0079c9f78055715a103f17e3133ceff1aacf2f403011
           58  +4872bcbc4cd0f0a9dc7c2f7045e5b43b6c830db8
           59  +bf5ce540ae51bc50399f96746c5a15bd
           60  +45161589ac317be0ceba70db2573ddda6e668a31984b39bf65e4b664b584c63d
           61  +abd37534c7d9a2efb9465de931cd7055ffdb8879563ae98078d6d6d5
           62  +ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb
           63  +54a59b9f22b0b80880d8427e548b7c23abd873486e1f035dce9cd697e85175033caa88e6d57bc35efae0b5afd3145f31
           64  +1f40fc92da241694750979ee6cf582f2d5d7d28e18335de05abc54d0560e0f5302860c652bf08d560252aa5e74210546f369fbbbce8c12cfc7957b2652fe9a75
           65  +9e86ff69557ca95f405f081269685b38e3a819b309ee942f482b6a8b
           66  +80084bf2fba02475726feb2cab2d8215eab14bc6bdd8bfb2c8151257032ecd8b
           67  +1815f774f320491b48569efec794d249eeb59aae46d22bf77dafe25c5edc28d7ea44f93ee1234aa88f61c91912a4ccd9
           68  +697f2d856172cb8309d6b8b97dac4de344b549d4dee61edfb4962d8698b7fa803f4f93ff24393586e28b5b957ac3d1d369420ce53332712f997bd336d09ab02a
           69  +943aa9225a2cf154ec2e4dd81237720ba538ca8df2fd83c0b893c5d265f353a0
           70  +b59ec44f7beef8a04ceed38a973d77c65e22e9458d5f67b497948da34986c093b5efc5483fbee55f2f740fcad31f18d80db44bb6b8843e7fd599188e7c07233b
           71  +7]ܹ7vg
           72  +16614b1f68c5c25eaf6136286c9c12932f4f73e87e90a273
           73  +q336in72uwt7zyk5dxolt2xk5i3xmz5y
           74  +hvfkN/qlp/zhXR3cuerq6jd2Z7g=
           75  +magnet:?xl=1&dn=file.txt&xt=urn:aich:q336in72uwt7zyk5dxolt2xk5i3xmz5y&xt=urn:crc32:e8b7be43
           76  +Done

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/bindings/php/tests/003.phpt version [3860fdac23].

            1  +--TEST--
            2  +test RHash file   methods
            3  +--FILE--
            4  +<?php
            5  +$filename = '003_test.txt';
            6  +
            7  +$handle = fopen($filename, "w+b");
            8  +fwrite($handle, "012abc678");
            9  +$r = new RHash(RHASH_MD5);
           10  +$r->update_stream($handle, 3, 3);
           11  +echo $r->final()->magnet($filename) . "\n";
           12  +fclose($handle);
           13  +
           14  +$r->reset()->update_file($filename);
           15  +echo $r->final()->magnet($filename) . "\n";
           16  +$r->reset()->update_file($filename, 2, 1);
           17  +echo $r->final()->magnet($filename) . "\n";
           18  +
           19  +// test global file reading functions
           20  +echo rhash_file(RHASH_TTH, $filename) . "\n";
           21  +echo rhash_magnet(RHASH_TTH, $filename) . "\n";
           22  +unlink($filename);
           23  +echo "Done\n";
           24  +?>
           25  +--EXPECTF--
           26  +magnet:?xl=3&dn=003_test.txt&xt=urn:md5:900150983cd24fb0d6963f7d28e17f72
           27  +magnet:?xl=12&dn=003_test.txt&xt=urn:md5:5a73501e89118bfc45e19f26c0bb2c33
           28  +magnet:?xl=13&dn=003_test.txt&xt=urn:md5:c81e728d9d4c2f636f067f89cc14862c
           29  +2yu5rdna7qwl6e3ivtgzleuft766u72dxnlzdri
           30  +magnet:?xl=9&dn=003_test.txt&xt=urn:tree:tiger:2yu5rdna7qwl6e3ivtgzleuft766u72dxnlzdri
           31  +Done

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/bindings/python/.gitignore version [b0acf915c5].

            1  +*.pyc

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/bindings/python/rhash.py version [4a7629b936].

            1  +# Python Bindings for Librhash
            2  +# Copyright (c) 2011-2012, Sergey Basalaev <sbasalaev@gmail.com>
            3  +# Librhash is (c) 2011-2012, Aleksey Kravchenko <rhash.admin@gmail.com>
            4  +#
            5  +# Permission is hereby granted, free of charge,  to any person obtaining a copy
            6  +# of this software and associated documentation files (the "Software"), to deal
            7  +# in the Software without restriction,  including without limitation the rights
            8  +# to  use,  copy,  modify,  merge, publish, distribute, sublicense, and/or sell
            9  +# copies  of  the Software,  and  to permit  persons  to whom  the Software  is
           10  +# furnished to do so.
           11  +#
           12  +# This library  is distributed  in the hope that it will be useful, but WITHOUT
           13  +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
           14  +# FOR A PARTICULAR PURPOSE. Use it at your own risk!
           15  +
           16  +"""Python bindings for librhash
           17  +
           18  +Librhash  is  a library for computing and verifying hash sums
           19  +that supports many hashing algorithms. The  simplest  way  to
           20  +calculate  hash  of  a message  or  a file is by using one of
           21  +the functions:
           22  +
           23  +hash_for_msg(message, hash_id)
           24  +hash_for_file(filename, hash_id)
           25  +magnet_for_file(filename, hash_ids)
           26  +
           27  +Here  hash_id  is one of the constants CRC32, MD4, MD5, SHA1,
           28  +TIGER, TTH, BTIH, ED2K,  AICH,  WHIRLPOOL,  RIPEMD160,  GOST,
           29  +GOST_CRYPTOPRO, HAS160, SNEFRU128, SNEFRU256, SHA224, SHA256,
           30  +SHA384,  SHA512,   SHA3_224,  SHA3_256,  SHA3_384,  SHA3_512,
           31  +EDONR256 or EDONR512.  The first  two functions  will  return
           32  +the  default text  representation of  the message digest they
           33  +compute.  The latter will return magnet  link  for the  file.
           34  +In this function  you can  OR-combine  several hash_ids, like
           35  +
           36  +>>> print magnet_for_file('rhash.py', CRC32 | MD5)
           37  +magnet:?xl=6041&dn=rhash.py&xt=urn:crc32:f5866f7a&xt=urn:md5:
           38  +f88e6c1620361da9d04e2a2a1c788059
           39  +
           40  +Next, this module provides a class to calculate several hashes
           41  +simultaneously in an incremental way. Example of using it:
           42  +
           43  +>>> hasher = RHash(CRC32 | MD5)
           44  +>>> hasher.update('Hello, ')
           45  +>>> hasher << 'world' << '!'
           46  +>>> hasher.finish()
           47  +>>> print hasher.HEX(CRC32)
           48  +EBE6C6E6
           49  +>>> print hasher.hex(MD5)
           50  +6cd3556deb0da54bca060b4c39479839
           51  +
           52  +In this example RHash object is first created for  a  set  of
           53  +hashing algorithms. Then, data for hashing is given in chunks
           54  +with   methods   update(message)  and  update_file(filename).
           55  +Finally, call finish() to end up all remaining calculations.
           56  +
           57  +To  receive  text represenation of the message digest use one
           58  +of the methods hex(), HEX(), base32(), BASE32(), base64() and
           59  +BASE64().  The hash() method  outputs  message digest  in its
           60  +default format.  Binary  message digest may be obtained  with
           61  +raw().  All of these  methods  accept  hash_id  as  argument.
           62  +It may  be omitted  if  RHash  was  created  to  compute hash
           63  +for only a single hashing algorithm.
           64  +
           65  +Method  magnet(filename)  will generate magnet link with  all
           66  +hashes computed by the RHash object.
           67  +"""
           68  +
           69  +# public API
           70  +__all__ = [
           71  +    'ALL', 'CRC32', 'MD4', 'MD5', 'SHA1', 'TIGER', 'TTH',
           72  +    'BTIH', 'ED2K', 'AICH', 'WHIRLPOOL', 'RIPEMD160', 'GOST',
           73  +    'GOST_CRYPTOPRO', 'HAS160', 'SNEFRU128', 'SNEFRU256',
           74  +    'SHA224', 'SHA256', 'SHA384', 'SHA512', 'EDONR256', 'EDONR512',
           75  +    'SHA3_224', 'SHA3_256', 'SHA3_384', 'SHA3_512',
           76  +    'RHash', 'hash_for_msg', 'hash_for_file', 'magnet_for_file']
           77  +
           78  +import sys
           79  +from ctypes import (
           80  +    CDLL, c_char_p, c_int, c_size_t, c_uint, c_void_p, create_string_buffer)
           81  +
           82  +# initialization
           83  +if sys.platform == 'win32':
           84  +    LIBNAME = 'librhash.dll'
           85  +elif sys.platform == 'darwin':
           86  +    LIBNAME = 'librhash.0.dylib'
           87  +elif sys.platform == 'cygwin':
           88  +    LIBNAME = 'cygrhash.dll'
           89  +elif sys.platform == 'msys':
           90  +    LIBNAME = 'msys-rhash.dll'
           91  +else:
           92  +    LIBNAME = 'librhash.so.0'
           93  +LIBRHASH = CDLL(LIBNAME)
           94  +LIBRHASH.rhash_library_init()
           95  +
           96  +# function prototypes
           97  +LIBRHASH.rhash_init.argtypes = [c_uint]
           98  +LIBRHASH.rhash_init.restype = c_void_p
           99  +LIBRHASH.rhash_free.argtypes = [c_void_p]
          100  +LIBRHASH.rhash_reset.argtypes = [c_void_p]
          101  +LIBRHASH.rhash_update.argtypes = [c_void_p, c_char_p, c_size_t]
          102  +LIBRHASH.rhash_final.argtypes = [c_void_p, c_char_p]
          103  +LIBRHASH.rhash_print.argtypes = [c_char_p, c_void_p, c_uint, c_int]
          104  +LIBRHASH.rhash_print.restype = c_size_t
          105  +LIBRHASH.rhash_print_magnet.argtypes = [
          106  +    c_char_p, c_char_p, c_void_p, c_uint, c_int]
          107  +LIBRHASH.rhash_print_magnet.restype = c_size_t
          108  +LIBRHASH.rhash_transmit.argtypes = [c_uint, c_void_p, c_size_t, c_size_t]
          109  +
          110  +# conversion of a string to binary data with Python 2/3 compatibility
          111  +if sys.version < '3':
          112  +    def _s2b(string):
          113  +        """Python 2: just return the string"""
          114  +        return string
          115  +    def _msg_to_bytes(msg):
          116  +        """convert the msg parameter to a string"""
          117  +        if isinstance(msg, str):
          118  +            return msg
          119  +        return str(msg)
          120  +else:
          121  +    import codecs
          122  +    def _s2b(string):
          123  +        """Python 3: convert the string to binary data"""
          124  +        return codecs.utf_8_encode(string)[0]
          125  +    def _msg_to_bytes(msg):
          126  +        """convert the msg parameter to binary data"""
          127  +        if isinstance(msg, bytes):
          128  +            return msg
          129  +        if isinstance(msg, str):
          130  +            return _s2b(msg)
          131  +        return _s2b(str(msg))
          132  +
          133  +# hash_id values
          134  +CRC32 = 0x01
          135  +MD4 = 0x02
          136  +MD5 = 0x04
          137  +SHA1 = 0x08
          138  +TIGER = 0x10
          139  +TTH = 0x20
          140  +BTIH = 0x40
          141  +ED2K = 0x80
          142  +AICH = 0x100
          143  +WHIRLPOOL = 0x200
          144  +RIPEMD160 = 0x400
          145  +GOST = 0x800
          146  +GOST_CRYPTOPRO = 0x1000
          147  +HAS160 = 0x2000
          148  +SNEFRU128 = 0x4000
          149  +SNEFRU256 = 0x8000
          150  +SHA224 = 0x10000
          151  +SHA256 = 0x20000
          152  +SHA384 = 0x40000
          153  +SHA512 = 0x80000
          154  +EDONR256 = 0x100000
          155  +EDONR512 = 0x200000
          156  +SHA3_224 = 0x0400000
          157  +SHA3_256 = 0x0800000
          158  +SHA3_384 = 0x1000000
          159  +SHA3_512 = 0x2000000
          160  +ALL = SHA3_512*2 - 1
          161  +
          162  +
          163  +#rhash_print values
          164  +RHPR_RAW = 1
          165  +RHPR_HEX = 2
          166  +RHPR_BASE32 = 3
          167  +RHPR_BASE64 = 4
          168  +RHPR_UPPERCASE = 8
          169  +RHPR_NO_MAGNET = 0x20
          170  +RHPR_FILESIZE = 0x40
          171  +
          172  +class RHash(object):
          173  +    'Incremental hasher'
          174  +
          175  +    def __init__(self, hash_ids):
          176  +        if hash_ids == 0:
          177  +            self._ctx = None
          178  +            raise ValueError('Invalid argument')
          179  +        self._ctx = LIBRHASH.rhash_init(hash_ids)
          180  +        #switching off the autofinal feature
          181  +        LIBRHASH.rhash_transmit(5, self._ctx, 0, 0)
          182  +
          183  +    def __del__(self):
          184  +        if self._ctx != None:
          185  +            LIBRHASH.rhash_free(self._ctx)
          186  +
          187  +    def reset(self):
          188  +        """reset this object to initial state"""
          189  +        LIBRHASH.rhash_reset(self._ctx)
          190  +        return self
          191  +
          192  +    def update(self, message):
          193  +        """update this object with new data chunk"""
          194  +        data = _msg_to_bytes(message)
          195  +        LIBRHASH.rhash_update(self._ctx, data, len(data))
          196  +        return self
          197  +
          198  +    def __lshift__(self, message):
          199  +        return self.update(message)
          200  +
          201  +    def update_file(self, filename):
          202  +        """Update this object with data from the given file."""
          203  +        file = open(filename, 'rb')
          204  +        buf = file.read(8192)
          205  +        while len(buf) > 0:
          206  +            self.update(buf)
          207  +            buf = file.read(8192)
          208  +        file.close()
          209  +        return self
          210  +
          211  +    def finish(self):
          212  +        """Calculate hashes for all the data buffered by
          213  +        the update() method.
          214  +        """
          215  +        LIBRHASH.rhash_final(self._ctx, None)
          216  +        return self
          217  +
          218  +    def _print(self, hash_id, flags):
          219  +        """Retrieve the message hash in required format."""
          220  +        buf = create_string_buffer(130)
          221  +        size = LIBRHASH.rhash_print(buf, self._ctx, hash_id, flags)
          222  +        if (flags & 3) == RHPR_RAW:
          223  +            return buf[0:size]
          224  +        else:
          225  +            return buf[0:size].decode()
          226  +
          227  +    def raw(self, hash_id=0):
          228  +        """Returns the message hash as raw binary data."""
          229  +        return self._print(hash_id, RHPR_RAW)
          230  +
          231  +    def hex(self, hash_id=0):
          232  +        """Returns the message hash as a hexadecimal lower-case string."""
          233  +        return self._print(hash_id, RHPR_HEX)
          234  +
          235  +    def base32(self, hash_id=0):
          236  +        """Returns the message hash as a Base32 lower-case string."""
          237  +        return self._print(hash_id, RHPR_BASE32)
          238  +
          239  +    def base64(self, hash_id=0):
          240  +        """Returns the message hash as a Base64 string."""
          241  +        return self._print(hash_id, RHPR_BASE64)
          242  +
          243  +    # pylint: disable=invalid-name
          244  +    def HEX(self, hash_id=0):
          245  +        """Returns the message hash as a hexadecimal upper-case string."""
          246  +        return self._print(hash_id, RHPR_HEX | RHPR_UPPERCASE)
          247  +
          248  +    def BASE32(self, hash_id=0):
          249  +        """Returns the message hash as a Base32 upper-case string."""
          250  +        return self._print(hash_id, RHPR_BASE32 | RHPR_UPPERCASE)
          251  +    # pylint: enable=invalid-name
          252  +
          253  +    def magnet(self, filepath):
          254  +        """Returns magnet link with all hashes computed by
          255  +        this object."""
          256  +        size = LIBRHASH.rhash_print_magnet(
          257  +            None, _s2b(filepath), self._ctx, ALL, RHPR_FILESIZE)
          258  +        buf = create_string_buffer(size)
          259  +        LIBRHASH.rhash_print_magnet(
          260  +            buf, _s2b(filepath), self._ctx, ALL, RHPR_FILESIZE)
          261  +        return buf[0:size-1].decode('utf-8')
          262  +
          263  +    def hash(self, hash_id=0):
          264  +        """Returns the message digest for the given hash function
          265  +        as a string in the default format."""
          266  +        return self._print(hash_id, 0)
          267  +
          268  +    def __str__(self):
          269  +        return self._print(0, 0)
          270  +
          271  +def hash_for_msg(message, hash_id):
          272  +    """Computes and returns the message digest (in its default format)
          273  +    of the message"""
          274  +    handle = RHash(hash_id)
          275  +    handle.update(message).finish()
          276  +    return str(handle)
          277  +
          278  +def hash_for_file(filename, hash_id):
          279  +    """Computes and returns the message digest (in its default format)
          280  +    of the file content"""
          281  +    handle = RHash(hash_id)
          282  +    handle.update_file(filename).finish()
          283  +    return str(handle)
          284  +
          285  +def magnet_for_file(filename, hash_mask):
          286  +    """Computes and returns the magnet link for the file."""
          287  +    handle = RHash(hash_mask)
          288  +    handle.update_file(filename).finish()
          289  +    return handle.magnet(filename)

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/bindings/python/test_rhash.py version [482c4c2e86].

            1  +# UnitTest for Librhash Python Bindings
            2  +# Copyright (c) 2011-2012, Aleksey Kravchenko <rhash.admin@gmail.com>
            3  +#
            4  +# Permission is hereby granted, free of charge,  to any person obtaining a copy
            5  +# of this software and associated documentation files (the "Software"), to deal
            6  +# in the Software without restriction,  including without limitation the rights
            7  +# to  use,  copy,  modify,  merge, publish, distribute, sublicense, and/or sell
            8  +# copies  of  the Software,  and  to permit  persons  to whom  the Software  is
            9  +# furnished to do so.
           10  +#
           11  +# This library  is distributed  in the hope that it will be useful, but WITHOUT
           12  +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
           13  +# FOR A PARTICULAR PURPOSE. Use it at your own risk!
           14  +"""Unit-tests for the rhash module"""
           15  +
           16  +import rhash
           17  +import os
           18  +import unittest
           19  +
           20  +# pylint: disable=too-many-public-methods, pointless-statement
           21  +class TestRHash(unittest.TestCase):
           22  +    """The test-case class for the rhash module"""
           23  +
           24  +    def test_all_hashes(self):
           25  +        """Verify all hash functions"""
           26  +        ctx = rhash.RHash(rhash.ALL)
           27  +        ctx.update('a')
           28  +        ctx.finish()
           29  +        self.assertEqual('e8b7be43', ctx.hash(rhash.CRC32))
           30  +        self.assertEqual('bde52cb31de33e46245e05fbdbd6fb24', ctx.hash(rhash.MD4))
           31  +        self.assertEqual('0cc175b9c0f1b6a831c399e269772661', ctx.hash(rhash.MD5))
           32  +        self.assertEqual(
           33  +            '86f7e437faa5a7fce15d1ddcb9eaeaea377667b8', ctx.hash(rhash.SHA1))
           34  +        self.assertEqual(
           35  +            '77befbef2e7ef8ab2ec8f93bf587a7fc613e247f5f247809',
           36  +            ctx.hash(rhash.TIGER))
           37  +        self.assertEqual(
           38  +            'czquwh3iyxbf5l3bgyugzhassmxu647ip2ike4y', ctx.hash(rhash.TTH))
           39  +        self.assertEqual(40, len(ctx.hash(rhash.BTIH)))
           40  +        self.assertEqual('bde52cb31de33e46245e05fbdbd6fb24', ctx.hash(rhash.ED2K))
           41  +        self.assertEqual('q336in72uwt7zyk5dxolt2xk5i3xmz5y', ctx.hash(rhash.AICH))
           42  +        self.assertEqual(
           43  +            '8aca2602792aec6f11a67206531fb7d7f0dff59413145e6973c45001d0087b42d11bc645413aeff63a42391a39145a591a92200d560195e53b478584fdae231a',
           44  +            ctx.hash(rhash.WHIRLPOOL))
           45  +        self.assertEqual(
           46  +            '0bdc9d2d256b3ee9daae347be6f4dc835a467ffe', ctx.hash(rhash.RIPEMD160))
           47  +        self.assertEqual(
           48  +            'd42c539e367c66e9c88a801f6649349c21871b4344c6a573f849fdce62f314dd',
           49  +            ctx.hash(rhash.GOST))
           50  +        self.assertEqual(
           51  +            'e74c52dd282183bf37af0079c9f78055715a103f17e3133ceff1aacf2f403011',
           52  +            ctx.hash(rhash.GOST_CRYPTOPRO))
           53  +        self.assertEqual(
           54  +            '4872bcbc4cd0f0a9dc7c2f7045e5b43b6c830db8',
           55  +            ctx.hash(rhash.HAS160))
           56  +        self.assertEqual(
           57  +            'bf5ce540ae51bc50399f96746c5a15bd', ctx.hash(rhash.SNEFRU128))
           58  +        self.assertEqual(
           59  +            '45161589ac317be0ceba70db2573ddda6e668a31984b39bf65e4b664b584c63d',
           60  +            ctx.hash(rhash.SNEFRU256))
           61  +        self.assertEqual(
           62  +            'abd37534c7d9a2efb9465de931cd7055ffdb8879563ae98078d6d6d5',
           63  +            ctx.hash(rhash.SHA224))
           64  +        self.assertEqual(
           65  +            'ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb',
           66  +            ctx.hash(rhash.SHA256))
           67  +        self.assertEqual(
           68  +            '54a59b9f22b0b80880d8427e548b7c23abd873486e1f035dce9cd697e85175033caa88e6d57bc35efae0b5afd3145f31',
           69  +            ctx.hash(rhash.SHA384))
           70  +        self.assertEqual(
           71  +            '1f40fc92da241694750979ee6cf582f2d5d7d28e18335de05abc54d0560e0f5302860c652bf08d560252aa5e74210546f369fbbbce8c12cfc7957b2652fe9a75',
           72  +            ctx.hash(rhash.SHA512))
           73  +        self.assertEqual(
           74  +            '943aa9225a2cf154ec2e4dd81237720ba538ca8df2fd83c0b893c5d265f353a0',
           75  +            ctx.hash(rhash.EDONR256))
           76  +        self.assertEqual(
           77  +            'b59ec44f7beef8a04ceed38a973d77c65e22e9458d5f67b497948da34986c093b5efc5483fbee55f2f740fcad31f18d80db44bb6b8843e7fd599188e7c07233b',
           78  +            ctx.hash(rhash.EDONR512))
           79  +        self.assertEqual(
           80  +            '9e86ff69557ca95f405f081269685b38e3a819b309ee942f482b6a8b',
           81  +            ctx.hash(rhash.SHA3_224))
           82  +        self.assertEqual(
           83  +            '80084bf2fba02475726feb2cab2d8215eab14bc6bdd8bfb2c8151257032ecd8b',
           84  +            ctx.hash(rhash.SHA3_256))
           85  +        self.assertEqual(
           86  +            '1815f774f320491b48569efec794d249eeb59aae46d22bf77dafe25c5edc28d7ea44f93ee1234aa88f61c91912a4ccd9',
           87  +            ctx.hash(rhash.SHA3_384))
           88  +        self.assertEqual(
           89  +            '697f2d856172cb8309d6b8b97dac4de344b549d4dee61edfb4962d8698b7fa803f4f93ff24393586e28b5b957ac3d1d369420ce53332712f997bd336d09ab02a',
           90  +            ctx.hash(rhash.SHA3_512))
           91  +        # test reset
           92  +        self.assertEqual(
           93  +            'd41d8cd98f00b204e9800998ecf8427e',
           94  +            ctx.reset().finish().hash(rhash.MD5)) # MD5( '' )
           95  +
           96  +    def test_update(self):
           97  +        """Test the sequential update calls"""
           98  +        ctx = rhash.RHash(rhash.CRC32 | rhash.MD5)
           99  +        ctx.update('Hello, ').update('world!').finish()
          100  +        self.assertEqual('EBE6C6E6', ctx.HEX(rhash.CRC32))
          101  +        self.assertEqual('6cd3556deb0da54bca060b4c39479839', ctx.hex(rhash.MD5))
          102  +
          103  +    def test_shift_operator(self):
          104  +        """Test the << operator"""
          105  +        ctx = rhash.RHash(rhash.MD5)
          106  +        ctx << 'a' << 'bc'
          107  +        # MD5( 'abc' )
          108  +        self.assertEqual('900150983cd24fb0d6963f7d28e17f72', str(ctx.finish()))
          109  +
          110  +    def test_hash_for_msg(self):
          111  +        """Test the hash_for_msg() function"""
          112  +        self.assertEqual(
          113  +            '900150983cd24fb0d6963f7d28e17f72',
          114  +            rhash.hash_for_msg('abc', rhash.MD5))
          115  +
          116  +    def test_output_formats(self):
          117  +        """Test all output formats of a message digest"""
          118  +        ctx = rhash.RHash(rhash.MD5 | rhash.TTH).finish()
          119  +        self.assertEqual(
          120  +            '5d9ed00a030e638bdb753a6a24fb900e5a63b8e73e6c25b6',
          121  +            ctx.hex(rhash.TTH))
          122  +        self.assertEqual('2qoyzwmpaczaj2mabgmoz6ccpy', ctx.base32(rhash.MD5))
          123  +        self.assertEqual('1B2M2Y8AsgTpgAmY7PhCfg==', ctx.base64(rhash.MD5))
          124  +        self.assertEqual(
          125  +            b'\xd4\x1d\x8c\xd9\x8f\x00\xb2\x04\xe9\x80\x09\x98\xec\xf8\x42\x7e',
          126  +            ctx.raw(rhash.MD5))
          127  +
          128  +    def test_magnet(self):
          129  +        """Test calculation of a magnet link"""
          130  +        ctx = rhash.RHash(rhash.MD5 | rhash.TTH)
          131  +        ctx.update('abc').finish()
          132  +        self.assertEqual(
          133  +            'magnet:?xl=3&dn=file.txt&xt=urn:md5:900150983cd24fb0d6963f7d28e17f72&xt=urn:tree:tiger:asd4ujseh5m47pdyb46kbtsqtsgdklbhyxomuia',
          134  +            ctx.magnet('file.txt'))
          135  +
          136  +    def test_update_file(self):
          137  +        """Test the update_file() method"""
          138  +        path = 'python_test_input_123.txt'
          139  +        file = open(path, 'wb')
          140  +        file.write(b"\0\1\2\n")
          141  +        file.close()
          142  +
          143  +        ctx = rhash.RHash(rhash.SHA1)
          144  +        ctx.update_file(path).finish()
          145  +        self.assertEqual('e3869ec477661fad6b9fc25914bb2eee5455b483', str(ctx))
          146  +        self.assertEqual(
          147  +            'e3869ec477661fad6b9fc25914bb2eee5455b483',
          148  +            rhash.hash_for_file(path, rhash.SHA1))
          149  +        self.assertEqual(
          150  +            'magnet:?xl=4&dn=python_test_input_123.txt&xt=urn:tree:tiger:c6docz63fpef5pdfpz35z7mw2iozshxlpr4erza',
          151  +            rhash.magnet_for_file(path, rhash.TTH))
          152  +        os.remove(path)
          153  +
          154  +if __name__ == '__main__':
          155  +    unittest.main()

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/bindings/ruby/.gitignore version [8256c8f7a4].

            1  +mkmf.log
            2  +rhash.so
            3  +Makefile

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/bindings/ruby/extconf.rb version [95aae1bc9e].

            1  +require 'mkmf'
            2  +
            3  +if ENV['LIBRHASH_INC']
            4  +    $CFLAGS  += ENV['LIBRHASH_INC']
            5  +else
            6  +    have_header('rhash.h')
            7  +end
            8  +
            9  +$LDFLAGS += ' ' + ENV['LIBRHASH_LD'] if ENV['LIBRHASH_LD']
           10  +$LDFLAGS += ' -lrhash'
           11  +
           12  +dir_config('rhash')
           13  +create_makefile('rhash')

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/bindings/ruby/rhash.c version [6088dfc9ec].

            1  +/*
            2  + * Ruby Bindings for Librhash
            3  + * Copyright (c) 2011-2012, Sergey Basalaev <sbasalaev@gmail.com>
            4  + * Librhash is (c) 2011-2012, Aleksey Kravchenko <rhash.admin@gmail.com>
            5  + * 
            6  + * Permission is hereby granted, free of charge,  to any person obtaining a copy
            7  + * of this software and associated documentation files (the "Software"), to deal
            8  + * in the Software without restriction,  including without limitation the rights
            9  + * to  use,  copy,  modify,  merge, publish, distribute, sublicense, and/or sell
           10  + * copies  of  the Software,  and  to permit  persons  to whom  the Software  is
           11  + * furnished to do so.
           12  + * 
           13  + * This library  is distributed  in the hope that it will be useful, but WITHOUT
           14  + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
           15  + * FOR A PARTICULAR PURPOSE. Use it at your own risk!
           16  + */
           17  +
           18  +#include <ruby.h>
           19  +#include <rhash.h>
           20  +
           21  +/* RHash class. */
           22  +static VALUE cRHash;
           23  +
           24  +static void rh_free(rhash ctx) {
           25  +	rhash_free(ctx);
           26  +}
           27  +
           28  +/**
           29  + * call-seq:
           30  + *   rhash.update(data) -> RHash
           31  + *   rhash << data      -> RHash
           32  + *
           33  + * Updates this <code>RHash</code> with new data chunk.
           34  + */
           35  +static VALUE rh_update(VALUE self, VALUE msg) {
           36  +	rhash ctx;
           37  +	Data_Get_Struct(self, struct rhash_context, ctx);
           38  +
           39  +	if (TYPE(msg) != T_STRING) {
           40  +		msg = rb_obj_as_string(msg); /* convert to string */
           41  +	}
           42  +
           43  +	rhash_update(ctx, RSTRING_PTR(msg), RSTRING_LEN(msg));
           44  +	return self;
           45  +}
           46  +
           47  +/* declaring non-static method to fix a warning on an unused function */
           48  +VALUE rh_update_file(VALUE self, VALUE file);
           49  +
           50  +/**
           51  + * call-seq:
           52  + *   rhash.update_file(filename) -> RHash
           53  + * 
           54  + * Updates this <code>RHash</code> with data from given file.
           55  + */
           56  +VALUE rh_update_file(VALUE self, VALUE file) {
           57  +	// this function is actually implemented in pure Ruby below
           58  +	// this allows us to handle files in platform-independent way
           59  +	return self;
           60  +}
           61  +
           62  +/**
           63  + * call-seq:
           64  + *   rhash.finish
           65  + *
           66  + * Finishes calculation for all data buffered by
           67  + * <code>update</code> and stops calculation of hashes.
           68  + */
           69  +static VALUE rh_finish(VALUE self) {
           70  +	rhash ctx;
           71  +	Data_Get_Struct(self, struct rhash_context, ctx);
           72  +	rhash_final(ctx, NULL);
           73  +	return self;
           74  +}
           75  +
           76  +/**
           77  + * call-seq:
           78  + *   rhash.reset
           79  + *
           80  + * Resets this RHash to initial state.
           81  + * The RHash becomes available to process
           82  + * new data chunks.
           83  + */
           84  +static VALUE rh_reset(VALUE self) {
           85  +	rhash ctx;
           86  +	Data_Get_Struct(self, struct rhash_context, ctx);
           87  +	rhash_reset(ctx);
           88  +	return self;
           89  +}
           90  +
           91  +static VALUE rh_print(VALUE self, VALUE type, int flags) {
           92  +	char buf[130];
           93  +	rhash ctx;
           94  +	Data_Get_Struct(self, struct rhash_context, ctx);
           95  +	int len = rhash_print(buf, ctx, type == Qnil ? 0 : FIX2INT(type), flags);
           96  +	return rb_str_new(buf, len);
           97  +}
           98  +
           99  +/**
          100  + * call-seq:
          101  + *   rhash.to_raw(id)
          102  + *   rhash.to_raw
          103  + *
          104  + * Returns value of the RHash digest as raw bytes.
          105  + * If RHash was created with a single hashing algorithm
          106  + * then argument may be omitted.
          107  + */
          108  +static VALUE rh_to_raw(int argc, VALUE* argv, VALUE self) {
          109  +	VALUE type;
          110  +	rb_scan_args(argc, argv, "01", &type);
          111  +	return rh_print(self, type, RHPR_RAW);
          112  +}
          113  +
          114  +/**
          115  + * call-seq:
          116  + *   rhash.to_hex(id)
          117  + *   rhash.to_hex
          118  + *
          119  + * Returns value of the RHash digest as hexadecimal string.
          120  + * If RHash was created with a single hashing algorithm
          121  + * then argument may be omitted.
          122  + */
          123  +static VALUE rh_to_hex(int argc, VALUE* argv, VALUE self) {
          124  +	VALUE type;
          125  +	rb_scan_args(argc, argv, "01", &type);
          126  +	return rh_print(self, type, RHPR_HEX);
          127  +}
          128  +
          129  +/**
          130  + * call-seq:
          131  + *   rhash.to_base32(id)
          132  + *   rhash.to_base32
          133  + *
          134  + * Returns value of the RHash digest as base32 string.
          135  + * If RHash was created with a single hashing algorithm
          136  + * then argument may be omitted.
          137  + */
          138  +static VALUE rh_to_base32(int argc, VALUE* argv, VALUE self) {
          139  +	VALUE type;
          140  +	rb_scan_args(argc, argv, "01", &type);
          141  +	return rh_print(self, type, RHPR_BASE32);
          142  +}
          143  +
          144  +/**
          145  + * call-seq:
          146  + *   rhash.magnet(filepath)
          147  + *   rhash.magnet
          148  + *
          149  + * Returns magnet link with all hashes computed by
          150  + * the RHash object.
          151  + * if filepath is specified, then it is url-encoded
          152  + * and included into the resulting magnet link.
          153  + */
          154  +static VALUE rh_magnet(int argc, VALUE* argv, VALUE self) {
          155  +	VALUE value;
          156  +	const char* filepath = 0;
          157  +	char* buf;
          158  +	size_t buf_size;
          159  +	rhash ctx;
          160  +
          161  +	Data_Get_Struct(self, struct rhash_context, ctx);
          162  +
          163  +	rb_scan_args(argc, argv, "01", &value);
          164  +	if (value != Qnil) {
          165  +		if (TYPE(value) != T_STRING) value = rb_obj_as_string(value);
          166  +		filepath = RSTRING_PTR(value);
          167  +	}
          168  +
          169  +	buf_size = rhash_print_magnet(0, filepath, ctx, RHASH_ALL_HASHES, RHPR_FILESIZE);
          170  +	buf = (char*)malloc(buf_size);
          171  +	if (!buf) return Qnil;
          172  +
          173  +	rhash_print_magnet(buf, filepath, ctx, RHASH_ALL_HASHES, RHPR_FILESIZE);
          174  +	value = rb_str_new2(buf);
          175  +	free(buf);
          176  +	return value;
          177  +}
          178  +
          179  +/**
          180  + * call-seq:
          181  + *   rhash.to_base64(id)
          182  + *   rhash.to_base64
          183  + *
          184  + * Returns value of the RHash digest as base64 string.
          185  + * If RHash was created with a single hashing algorithm
          186  + * then argument may be omitted.
          187  + */
          188  +static VALUE rh_to_base64(int argc, VALUE* argv, VALUE self) {
          189  +	VALUE type;
          190  +	rb_scan_args(argc, argv, "01", &type);
          191  +	return rh_print(self, type, RHPR_BASE64);
          192  +}
          193  +
          194  +/**
          195  + * call-seq:
          196  + *   rhash.to_s(id)
          197  + *   rhash.to_s
          198  + *
          199  + * Returns value of the RHash digest for given algorithm
          200  + * as string in default format. If RHash was created with
          201  + * a single hashing algorithm then argument may be omitted.
          202  + */
          203  +static VALUE rh_to_s(int argc, VALUE* argv, VALUE self) {
          204  +	VALUE type;
          205  +	rb_scan_args(argc, argv, "01", &type);
          206  +	return rh_print(self, type, 0);
          207  +}
          208  +
          209  +/**
          210  + * call-seq:
          211  + *   RHash.base32?(id) -> true or false
          212  + *
          213  + * Returns true if default format for given hash algorithm is
          214  + * base32 and false if it is hexadecimal.
          215  + */
          216  +static VALUE rh_is_base32(VALUE self, VALUE type) {
          217  +	return rhash_is_base32(FIX2INT(type)) ? Qtrue : Qfalse;
          218  +}
          219  +
          220  +static VALUE rh_init(int argc, VALUE *argv, VALUE self) {
          221  +	return self;
          222  +}
          223  +
          224  +/**
          225  + * call-seq:
          226  + *   RHash.new(id, ...)
          227  + *
          228  + * Creates RHash object to calculate hashes for given algorithms.
          229  + * Parameters should be constants defined in this class.
          230  + */
          231  +VALUE rh_new(int argc, VALUE* argv, VALUE clz) {
          232  +	int flags = 0, i;
          233  +	for (i=0; i<argc; i++) {
          234  +		flags |= FIX2INT(argv[i]);
          235  +	}
          236  +	if (!flags) flags = RHASH_ALL_HASHES;
          237  +	rhash ctx = rhash_init(flags);
          238  +	rhash_set_autofinal(ctx, 0);
          239  +	VALUE newobj = Data_Wrap_Struct(clz, NULL, rh_free, ctx);
          240  +	rb_obj_call_init(newobj, argc, argv);
          241  +	return newobj;
          242  +}
          243  +
          244  +/**
          245  + * Librhash is a library for computing and verifying hash sums
          246  + * that supports many hashing algorithms. This module provides
          247  + * class for incremental hashing that utilizes the library.
          248  + * Sample usage of it you can see from the following example:
          249  + * 
          250  + *   hasher = RHash.new(RHash::CRC32, RHash::MD5)
          251  + *   hasher.update('Hello, ')
          252  + *   hasher << 'world' << '!'
          253  + *   hasher.finish
          254  + *   puts hasher.to_hex RHash::CRC32
          255  + *   puts hasher.to_base32 RHash::MD5
          256  + *
          257  + * which produces
          258  + *
          259  + *   ebe6c6e6
          260  + *   ntjvk3plbwsuxsqgbngdsr4yhe
          261  + *
          262  + * In this example <code>RHash</code> object is first created
          263  + * for a set of hashing algorithms.
          264  + *
          265  + * Next, data for hashing is  given  in  chunks  with  methods
          266  + * <code>update</code> and <code>update_file</code>. Finally,
          267  + * call <code>finish</code> to end up all remaining calculations.
          268  + *
          269  + * To receive text represenation of the message digest use one
          270  + * of methods <code>to_hex</code>, <code>to_base32</code> and
          271  + * <code>to_base64</code>. Binary message digest may be obtained
          272  + * with <code>to_raw</code>. All of these methods accept algorithm
          273  + * value as argument. It may be omitted if <code>RHash</code> was
          274  + * created to compute hash for only a single hashing algorithm.
          275  + */
          276  +void Init_rhash() {
          277  +	rhash_library_init();
          278  +	
          279  +	cRHash = rb_define_class("RHash", rb_cObject);
          280  +	
          281  +	rb_define_singleton_method(cRHash, "new", rh_new, -1);
          282  +	rb_define_singleton_method(cRHash, "base32?", rh_is_base32, 1);
          283  +	
          284  +	rb_define_method(cRHash, "initialize", rh_init,  -1);
          285  +	rb_define_method(cRHash, "update",     rh_update, 1);
          286  +	rb_define_method(cRHash, "<<",         rh_update, 1);
          287  +	rb_define_method(cRHash, "finish",     rh_finish, 0);
          288  +	rb_define_method(cRHash, "reset",      rh_reset,  0);
          289  +	rb_define_method(cRHash, "to_raw",     rh_to_raw, -1);
          290  +	rb_define_method(cRHash, "to_hex",     rh_to_hex, -1);
          291  +	rb_define_method(cRHash, "to_base32",  rh_to_base32, -1);
          292  +	rb_define_method(cRHash, "to_base64",  rh_to_base64, -1);
          293  +	rb_define_method(cRHash, "to_s",       rh_to_s, -1);
          294  +	rb_define_method(cRHash, "magnet",     rh_magnet, -1);
          295  +	
          296  +	rb_eval_string(
          297  +"class RHash \n\
          298  +  def update_file(filename) \n\
          299  +    f = File.open(filename, 'rb') \n\
          300  +    while block = f.read(4096) \n\
          301  +      self.update(block) \n\
          302  +    end \n\
          303  +    f.close \n\
          304  +    self \n\
          305  +  end \n\
          306  +end\n\
          307  +\n\
          308  +def RHash.hash_for_msg(msg, hash_id)\n\
          309  +  RHash.new(hash_id).update(msg).finish.to_s\n\
          310  +end\n\
          311  +\n\
          312  +def RHash.hash_for_file(filename, hash_id)\n\
          313  +  RHash.new(hash_id).update_file(filename).finish.to_s\n\
          314  +end\n\
          315  +\n\
          316  +def RHash.magnet_for_file(filename, *hash_ids)\n\
          317  +  RHash.new(*hash_ids).update_file(filename).finish.magnet(filename)\n\
          318  +end");
          319  +	
          320  +	/** CRC32 checksum. */
          321  +	rb_define_const(cRHash, "CRC32",     INT2FIX(RHASH_CRC32));
          322  +	/** MD4 hash. */
          323  +	rb_define_const(cRHash, "MD4",       INT2FIX(RHASH_MD4));
          324  +	/** MD5 hash. */
          325  +	rb_define_const(cRHash, "MD5",       INT2FIX(RHASH_MD5));
          326  +	/** SHA-1 hash. */
          327  +	rb_define_const(cRHash, "SHA1",      INT2FIX(RHASH_SHA1));
          328  +	/** Tiger hash. */
          329  +	rb_define_const(cRHash, "TIGER",     INT2FIX(RHASH_TIGER));
          330  +	/** Tiger tree hash */
          331  +	rb_define_const(cRHash, "TTH",       INT2FIX(RHASH_TTH));
          332  +	/** BitTorrent info hash. */
          333  +	rb_define_const(cRHash, "BTIH",      INT2FIX(RHASH_BTIH));
          334  +	/** EDonkey 2000 hash. */
          335  +	rb_define_const(cRHash, "ED2K",      INT2FIX(RHASH_ED2K));
          336  +	/** eMule AICH. */
          337  +	rb_define_const(cRHash, "AICH",      INT2FIX(RHASH_AICH));
          338  +	/** Whirlpool hash. */
          339  +	rb_define_const(cRHash, "WHIRLPOOL", INT2FIX(RHASH_WHIRLPOOL));
          340  +	/** RIPEMD-160 hash. */
          341  +	rb_define_const(cRHash, "RIPEMD160", INT2FIX(RHASH_RIPEMD160));
          342  +	/** GOST R 34.11-94. */
          343  +	rb_define_const(cRHash, "GOST",      INT2FIX(RHASH_GOST));
          344  +	/** GOST R 34.11-94. */
          345  +	rb_define_const(cRHash, "GOST_CRYPTOPRO", INT2FIX(RHASH_GOST_CRYPTOPRO));
          346  +	/** HAS-160 hash. */
          347  +	rb_define_const(cRHash, "HAS160",    INT2FIX(RHASH_HAS160));
          348  +	/** Snefru-128 hash. */
          349  +	rb_define_const(cRHash, "SNEFRU128", INT2FIX(RHASH_SNEFRU128));
          350  +	/** Snefru-256 hash. */
          351  +	rb_define_const(cRHash, "SNEFRU256", INT2FIX(RHASH_SNEFRU256));
          352  +	/** SHA-224 hash. */
          353  +	rb_define_const(cRHash, "SHA224",    INT2FIX(RHASH_SHA224));
          354  +	/** SHA-256 hash. */
          355  +	rb_define_const(cRHash, "SHA256",    INT2FIX(RHASH_SHA256));
          356  +	/** SHA-384 hash. */
          357  +	rb_define_const(cRHash, "SHA384",    INT2FIX(RHASH_SHA384));
          358  +	/** SHA-512 hash. */
          359  +	rb_define_const(cRHash, "SHA512",    INT2FIX(RHASH_SHA512));
          360  +	/** EDON-R 256. */
          361  +	rb_define_const(cRHash, "EDONR256",  INT2FIX(RHASH_EDONR256));
          362  +	/** EDON-R 512. */
          363  +	rb_define_const(cRHash, "EDONR512",  INT2FIX(RHASH_EDONR512));
          364  +	/** SHA3-224 hash. */
          365  +	rb_define_const(cRHash, "SHA3_224",    INT2FIX(RHASH_SHA3_224));
          366  +	/** SHA3-256 hash. */
          367  +	rb_define_const(cRHash, "SHA3_256",    INT2FIX(RHASH_SHA3_256));
          368  +	/** SHA3-384 hash. */
          369  +	rb_define_const(cRHash, "SHA3_384",    INT2FIX(RHASH_SHA3_384));
          370  +	/** SHA3-512 hash. */
          371  +	rb_define_const(cRHash, "SHA3_512",    INT2FIX(RHASH_SHA3_512));
          372  +	/** Create RHash with this parameter to compute hashes for all available algorithms. */
          373  +	rb_define_const(cRHash, "ALL",       INT2FIX(RHASH_ALL_HASHES));
          374  +}
          375  +

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/bindings/ruby/test_rhash.rb version [d078a806a4].

            1  +#!/usr/bin/ruby
            2  +
            3  +require "test/unit"
            4  +require "rhash"
            5  +
            6  +class TestRHash < Test::Unit::TestCase
            7  +
            8  +    def test_all_hashes
            9  +	r = RHash.new(RHash::ALL)
           10  +	r.update("a").finish()
           11  +
           12  +	assert_equal("e8b7be43", r.to_s(RHash::CRC32))
           13  +	assert_equal("bde52cb31de33e46245e05fbdbd6fb24", r.to_s(RHash::MD4))
           14  +	assert_equal("0cc175b9c0f1b6a831c399e269772661", r.to_s(RHash::MD5))
           15  +	assert_equal("86f7e437faa5a7fce15d1ddcb9eaeaea377667b8", r.to_s(RHash::SHA1))
           16  +	assert_equal("77befbef2e7ef8ab2ec8f93bf587a7fc613e247f5f247809", r.to_s(RHash::TIGER))
           17  +	assert_equal("czquwh3iyxbf5l3bgyugzhassmxu647ip2ike4y", r.to_s(RHash::TTH))
           18  +	assert_equal(40, r.to_s(RHash::BTIH).length())
           19  +	assert_equal("bde52cb31de33e46245e05fbdbd6fb24", r.to_s(RHash::ED2K))
           20  +	assert_equal("q336in72uwt7zyk5dxolt2xk5i3xmz5y", r.to_s(RHash::AICH))
           21  +	assert_equal("8aca2602792aec6f11a67206531fb7d7f0dff59413145e6973c45001d0087b42d11bc645413aeff63a42391a39145a591a92200d560195e53b478584fdae231a", r.to_s(RHash::WHIRLPOOL))
           22  +	assert_equal("0bdc9d2d256b3ee9daae347be6f4dc835a467ffe", r.to_s(RHash::RIPEMD160))
           23  +	assert_equal("d42c539e367c66e9c88a801f6649349c21871b4344c6a573f849fdce62f314dd", r.to_s(RHash::GOST))
           24  +	assert_equal("e74c52dd282183bf37af0079c9f78055715a103f17e3133ceff1aacf2f403011", r.to_s(RHash::GOST_CRYPTOPRO))
           25  +	assert_equal("4872bcbc4cd0f0a9dc7c2f7045e5b43b6c830db8", r.to_s(RHash::HAS160))
           26  +	assert_equal("bf5ce540ae51bc50399f96746c5a15bd", r.to_s(RHash::SNEFRU128))
           27  +	assert_equal("45161589ac317be0ceba70db2573ddda6e668a31984b39bf65e4b664b584c63d", r.to_s(RHash::SNEFRU256))
           28  +	assert_equal("abd37534c7d9a2efb9465de931cd7055ffdb8879563ae98078d6d6d5", r.to_s(RHash::SHA224))
           29  +	assert_equal("ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb", r.to_s(RHash::SHA256))
           30  +	assert_equal("54a59b9f22b0b80880d8427e548b7c23abd873486e1f035dce9cd697e85175033caa88e6d57bc35efae0b5afd3145f31", r.to_s(RHash::SHA384))
           31  +	assert_equal("1f40fc92da241694750979ee6cf582f2d5d7d28e18335de05abc54d0560e0f5302860c652bf08d560252aa5e74210546f369fbbbce8c12cfc7957b2652fe9a75", r.to_s(RHash::SHA512))
           32  +	assert_equal("943aa9225a2cf154ec2e4dd81237720ba538ca8df2fd83c0b893c5d265f353a0", r.to_s(RHash::EDONR256))
           33  +	assert_equal("b59ec44f7beef8a04ceed38a973d77c65e22e9458d5f67b497948da34986c093b5efc5483fbee55f2f740fcad31f18d80db44bb6b8843e7fd599188e7c07233b", r.to_s(RHash::EDONR512))
           34  +	assert_equal("9e86ff69557ca95f405f081269685b38e3a819b309ee942f482b6a8b", r.to_s(RHash::SHA3_224))
           35  +	assert_equal("80084bf2fba02475726feb2cab2d8215eab14bc6bdd8bfb2c8151257032ecd8b", r.to_s(RHash::SHA3_256))
           36  +	assert_equal("1815f774f320491b48569efec794d249eeb59aae46d22bf77dafe25c5edc28d7ea44f93ee1234aa88f61c91912a4ccd9", r.to_s(RHash::SHA3_384))
           37  +	assert_equal("697f2d856172cb8309d6b8b97dac4de344b549d4dee61edfb4962d8698b7fa803f4f93ff24393586e28b5b957ac3d1d369420ce53332712f997bd336d09ab02a", r.to_s(RHash::SHA3_512))
           38  +
           39  +	assert_equal("d41d8cd98f00b204e9800998ecf8427e", r.reset().finish().to_s(RHash::MD5)) # MD5( "" )
           40  +    end
           41  +
           42  +    def test_shift_operator
           43  +	r = RHash.new(RHash::MD5)
           44  +	r << "a" << "bc"
           45  +	assert_equal("900150983cd24fb0d6963f7d28e17f72", r.finish().to_s()) # MD5( "abc" )
           46  +    end
           47  +
           48  +    def test_output
           49  +	r = RHash.new(RHash::MD5, RHash::TTH)
           50  +	r.finish()
           51  +	assert_equal("5d9ed00a030e638bdb753a6a24fb900e5a63b8e73e6c25b6", r.to_hex(RHash::TTH))
           52  +	assert_equal("2qoyzwmpaczaj2mabgmoz6ccpy", r.to_base32(RHash::MD5))
           53  +	assert_equal("1B2M2Y8AsgTpgAmY7PhCfg==", r.to_base64(RHash::MD5))
           54  +	assert_equal(["d41d8cd98f00b204e9800998ecf8427e"].pack('H*'), r.to_raw(RHash::MD5))
           55  +    end
           56  +
           57  +    def test_magnet
           58  +	r = RHash.new(RHash::MD5, RHash::TTH)
           59  +	r.update("abc").finish()
           60  +	assert_equal("magnet:?xl=3&dn=file.txt&xt=urn:md5:900150983cd24fb0d6963f7d28e17f72&xt=urn:tree:tiger:asd4ujseh5m47pdyb46kbtsqtsgdklbhyxomuia", r.magnet("file.txt"))
           61  +    end
           62  +
           63  +    def test_update_file
           64  +	path = "ruby_test_input_123.txt"
           65  +	File.open(path, 'wb') { |f| f.write("\0\1\2\n") }
           66  +	r = RHash.new(RHash::SHA1)
           67  +	r.update_file(path).finish()
           68  +	assert_equal("e3869ec477661fad6b9fc25914bb2eee5455b483", r.to_s(RHash::SHA1))
           69  +	File.delete(path)
           70  +    end
           71  +
           72  +end

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/bindings/version.properties version [23ac2837b6].

            1  +version=1.3.6

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/calc_sums.c version [9e3baef55a].

            1  +/* calc_sums.c - crc calculating and printing functions */
            2  +
            3  +#include "platform.h" /* unlink() on unix */
            4  +#include <stdio.h>
            5  +#include <string.h>
            6  +#include <stdlib.h> /* free() */
            7  +#include <errno.h>
            8  +#include <assert.h>
            9  +#ifdef _WIN32
           10  +# include <fcntl.h>  /* _O_BINARY */
           11  +# include <io.h>
           12  +#endif
           13  +
           14  +#include "calc_sums.h"
           15  +#include "common_func.h"
           16  +#include "file.h"
           17  +#include "hash_print.h"
           18  +#include "output.h"
           19  +#include "parse_cmdline.h"
           20  +#include "rhash_main.h"
           21  +#include "win_utils.h"
           22  +#include "librhash/rhash.h"
           23  +#include "librhash/rhash_torrent.h"
           24  +
           25  +/**
           26  + * Initialize BTIH hash function. Unlike other algorithms BTIH
           27  + * requires more data for correct computation.
           28  + *
           29  + * @param info the file data
           30  + */
           31  +static void init_btih_data(struct file_info *info)
           32  +{
           33  +	assert((info->rctx->hash_id & RHASH_BTIH) != 0);
           34  +
           35  +	rhash_torrent_add_file(info->rctx, file_info_get_utf8_print_path(info), info->size);
           36  +	rhash_torrent_set_program_name(info->rctx, get_bt_program_name());
           37  +
           38  +	if (opt.flags & OPT_BT_PRIVATE) {
           39  +		rhash_torrent_set_options(info->rctx, RHASH_TORRENT_OPT_PRIVATE);
           40  +	}
           41  +
           42  +	if (opt.bt_announce) {
           43  +		size_t i;
           44  +		for (i = 0; i < opt.bt_announce->size; i++) {
           45  +			rhash_torrent_add_announce(info->rctx, (const char*)opt.bt_announce->array[i]);
           46  +		}
           47  +	}
           48  +
           49  +	if (opt.bt_piece_length) {
           50  +		rhash_torrent_set_piece_length(info->rctx, opt.bt_piece_length);
           51  +	}
           52  +	else if (opt.bt_batch_file && rhash_data.batch_size) {
           53  +		rhash_torrent_set_batch_size(info->rctx, rhash_data.batch_size);
           54  +	}
           55  +}
           56  +
           57  +/**
           58  + * (Re)-initialize RHash context, to calculate hash sums.
           59  + *
           60  + * @param info the file data
           61  + */
           62  +static void re_init_rhash_context(struct file_info *info)
           63  +{
           64  +	if (rhash_data.rctx != 0) {
           65  +		if (opt.mode & (MODE_CHECK | MODE_CHECK_EMBEDDED)) {
           66  +			/* a set of hash sums can change from file to file */
           67  +			rhash_free(rhash_data.rctx);
           68  +			rhash_data.rctx = 0;
           69  +		} else {
           70  +			info->rctx = rhash_data.rctx;
           71  +
           72  +			if (opt.bt_batch_file) {
           73  +				/* add another file to the torrent batch */
           74  +				rhash_torrent_add_file(info->rctx, file_info_get_utf8_print_path(info), info->size);
           75  +				return;
           76  +			} else {
           77  +				rhash_reset(rhash_data.rctx);
           78  +			}
           79  +		}
           80  +	}
           81  +
           82  +	if (rhash_data.rctx == 0) {
           83  +		rhash_data.rctx = rhash_init(info->sums_flags);
           84  +		info->rctx = rhash_data.rctx;
           85  +	}
           86  +
           87  +	if (info->sums_flags & RHASH_BTIH) {
           88  +		/* re-initialize BitTorrent data */
           89  +		init_btih_data(info);
           90  +	}
           91  +}
           92  +
           93  +/**
           94  + * Calculate hash sums simultaneously, according to the info->sums_flags.
           95  + * Calculated hashes are stored in info->rctx.
           96  + *
           97  + * @param info file data. The info->full_path can be "-" to denote stdin
           98  + * @return 0 on success, -1 on fail with error code stored in errno
           99  + */
          100  +static int calc_sums(struct file_info *info)
          101  +{
          102  +	FILE* fd = stdin; /* stdin */
          103  +	int res;
          104  +
          105  +	assert(info->file);
          106  +	if (info->file->mode & FILE_IFSTDIN) {
          107  +		info->print_path = "(stdin)";
          108  +
          109  +#ifdef _WIN32
          110  +		/* using 0 instead of _fileno(stdin). _fileno() is undefined under 'gcc -ansi' */
          111  +		if (setmode(0, _O_BINARY) < 0) {
          112  +			return -1;
          113  +		}
          114  +#endif
          115  +	} else {
          116  +		if ((opt.mode & (MODE_CHECK | MODE_CHECK_EMBEDDED)) && FILE_ISDIR(info->file)) {
          117  +			errno = EISDIR;
          118  +			return -1;
          119  +		}
          120  +
          121  +		info->size = info->file->size; /* total size, in bytes */
          122  +
          123  +		if (!info->sums_flags) return 0;
          124  +
          125  +		/* skip without reporting an error the files
          126  +		 * opened exclusively by another process */
          127  +		fd = file_fopen(info->file, FOpenRead | FOpenBin);
          128  +		if (!fd) return -1;
          129  +	}
          130  +
          131  +	re_init_rhash_context(info);
          132  +	/* save initial msg_size, for correct calculation of percents */
          133  +	info->msg_offset = info->rctx->msg_size;
          134  +
          135  +	if (percents_output->update != 0) {
          136  +		rhash_set_callback(info->rctx, (rhash_callback_t)percents_output->update, info);
          137  +	}
          138  +
          139  +	/* read and hash file content */
          140  +	if ((res = rhash_file_update(info->rctx, fd)) != -1) {
          141  +		if (!opt.bt_batch_file) {
          142  +			rhash_final(info->rctx, 0); /* finalize hashing */
          143  +		}
          144  +	}
          145  +	/* calculate real file size */
          146  +	info->size = info->rctx->msg_size - info->msg_offset;
          147  +	rhash_data.total_size += info->size;
          148  +
          149  +	if (fd != stdin) fclose(fd);
          150  +	return res;
          151  +}
          152  +
          153  +/**
          154  + * Free memory allocated by given file_info structure.
          155  + *
          156  + * @param info pointer the structure to de-initialize
          157  + */
          158  +void file_info_destroy(struct file_info* info)
          159  +{
          160  +	free(info->utf8_print_path);
          161  +	free(info->allocated_ptr);
          162  +}
          163  +
          164  +/**
          165  + * Store print_path in a file_info struct, replacing if needed
          166  + * system path separators with specified by user command line option.
          167  + *
          168  + * @param info pointer to the the file_info structure to change
          169  + * @param print_path the print path to store
          170  + */
          171  +static void file_info_set_print_path(struct file_info* info, const char* print_path)
          172  +{
          173  +	char *p;
          174  +	char wrong_sep;
          175  +
          176  +	/* check if path separator was specified by command line options */
          177  +	if (opt.path_separator) {
          178  +		wrong_sep = (opt.path_separator == '/' ? '\\' : '/');
          179  +		if ((p = (char*)strchr(print_path, wrong_sep)) != NULL) {
          180  +			info->allocated_ptr = rsh_strdup(print_path);
          181  +			info->print_path = info->allocated_ptr;
          182  +			p = info->allocated_ptr + (p - print_path);
          183  +
          184  +			/* replace wrong_sep in the print_path with separator defined by options */
          185  +			for (; *p; p++) {
          186  +				if (*p == wrong_sep) *p = opt.path_separator;
          187  +			}
          188  +			return;
          189  +		}
          190  +	}
          191  +
          192  +	/* if path was not replaces, than just store the value */
          193  +	info->print_path = print_path;
          194  +}
          195  +
          196  +/**
          197  + * Return utf8 version of print_path.
          198  + *
          199  + * @param info file information
          200  + * @return utf8 string on success, NULL if couldn't convert.
          201  + */
          202  +const char* file_info_get_utf8_print_path(struct file_info* info)
          203  +{
          204  +	if (info->utf8_print_path == NULL) {
          205  +		if (is_utf8()) return info->print_path;
          206  +		info->utf8_print_path = to_utf8(info->print_path);
          207  +	}
          208  +	return info->utf8_print_path;
          209  +}
          210  +
          211  +/* functions to calculate and print file sums */
          212  +
          213  +/**
          214  + * Search for a crc32 hash sum in the given file name.
          215  + *
          216  + * @param filepath the path to the file.
          217  + * @param crc32 pointer to integer to receive parsed hash sum.
          218  + * @return non zero if crc32 was found, zero otherwise.
          219  + */
          220  +static int find_embedded_crc32(const char* filepath, unsigned* crc32)
          221  +{
          222  +	const char* e = filepath + strlen(filepath) - 10;
          223  +	unsigned char raw[4];
          224  +
          225  +	/* search for the sum enclosed in brackets */
          226  +	for (; e >= filepath && !IS_PATH_SEPARATOR(*e); e--) {
          227  +		if ((*e == '[' && e[9] == ']') || (*e == '(' && e[9] == ')')) {
          228  +			const char *p = e + 8;
          229  +			for (; p > e && IS_HEX(*p); p--);
          230  +			if (p == e) {
          231  +				rhash_hex_to_byte(e + 1, raw, 8);
          232  +				*crc32 = ((unsigned)raw[0] << 24) | ((unsigned)raw[1] << 16) |
          233  +					((unsigned)raw[2] << 8) | (unsigned)raw[3];
          234  +				return 1;
          235  +			}
          236  +			e -= 9;
          237  +		}
          238  +	}
          239  +	return 0;
          240  +}
          241  +
          242  +/**
          243  + * Rename given file inserting its crc32 sum enclosed into square braces
          244  + * and placing it right before the file extension.
          245  + *
          246  + * @param info pointer to the data of the file to rename.
          247  + * @return 0 on success, -1 on fail with error code in errno
          248  + */
          249  +int rename_file_by_embeding_crc32(struct file_info *info)
          250  +{
          251  +	size_t len = strlen(info->full_path);
          252  +	const char* p = info->full_path + len;
          253  +	const char* c = p - 1;
          254  +	char* new_path;
          255  +	char* insertion_point;
          256  +	unsigned crc32;
          257  +	assert((info->rctx->hash_id & RHASH_CRC32) != 0);
          258  +
          259  +	/* check if the filename contains a CRC32 sum */
          260  +	if (find_embedded_crc32(info->print_path, &crc32)) {
          261  +		/* compare with calculated CRC32 */
          262  +		if (crc32 != get_crc32(info->rctx)) {
          263  +			char crc32_str[9];
          264  +			rhash_print(crc32_str, info->rctx, RHASH_CRC32, RHPR_UPPERCASE);
          265  +			/* TRANSLATORS: sample filename with embedded CRC32: file_[A1B2C3D4].mkv */
          266  +			log_warning(_("wrong embedded CRC32, should be %s\n"), crc32_str);
          267  +		} else return 0;
          268  +	}
          269  +
          270  +	/* find file extension (as the place to insert the hash sum) */
          271  +	for (; c >= info->full_path && !IS_PATH_SEPARATOR(*c); c--) {
          272  +		if (*c == '.') {
          273  +			p = c;
          274  +			break;
          275  +		}
          276  +	}
          277  +
          278  +	/* now p is the point to insert delimiter + hash string in brackets */
          279  +	new_path = (char*)rsh_malloc(len + 12);
          280  +	insertion_point = new_path + (p - info->full_path);
          281  +	memcpy(new_path, info->full_path, p - info->full_path);
          282  +	if (opt.embed_crc_delimiter && *opt.embed_crc_delimiter) *(insertion_point++) = *opt.embed_crc_delimiter;
          283  +	rhash_print(insertion_point+1, info->rctx, RHASH_CRC32, RHPR_UPPERCASE);
          284  +	insertion_point[0] = '[';
          285  +	insertion_point[9] = ']'; /* ']' overrides '\0' inserted by rhash_print_sum() */
          286  +	strcpy(insertion_point + 10, p); /* append file extension */
          287  +
          288  +	/* rename the file */
          289  +	if (rename(info->full_path, new_path) < 0) {
          290  +		log_error(_("can't move %s to %s: %s\n"), info->full_path, new_path,
          291  +			strerror(errno));
          292  +		free(new_path);
          293  +		return -1;
          294  +	}
          295  +
          296  +	/* change file name in the file info structure */
          297  +	if (info->print_path >= info->full_path && info->print_path < p) {
          298  +		file_info_set_print_path(info, new_path + len - strlen(info->print_path));
          299  +	} else {
          300  +		file_info_set_print_path(info, new_path);
          301  +	}
          302  +
          303  +	free(info->full_path);
          304  +	info->full_path = new_path;
          305  +	return 0;
          306  +}
          307  +
          308  +/**
          309  + * Save torrent file to the given path.
          310  + *
          311  + * @param path the path to save torrent file to
          312  + * @param rctx the context containing torrent data
          313  + * @return 0 on success, -1 on fail with error code in errno
          314  + */
          315  +int save_torrent_to(const char* path, rhash_context* rctx)
          316  +{
          317  +	file_t file;
          318  +	FILE* fd;
          319  +	int res = 0;
          320  +
          321  +	const rhash_str* text = rhash_torrent_generate_content(rctx);
          322  +	if (!text) {
          323  +		errno = ENOMEM;
          324  +		log_file_error(path);
          325  +		return -1;
          326  +	}
          327  +
          328  +	if (if_file_exists(path)) {
          329  +		/* make backup copy of the existing torrent file */
          330  +		char *bak_path = str_append(path, ".bak");
          331  +		unlink(bak_path);
          332  +		rename(path, bak_path);
          333  +		free(bak_path);
          334  +	}
          335  +
          336  +	/* write the torrent file */
          337  +	file_init(&file, path, FILE_OPT_DONT_FREE_PATH);
          338  +	fd = file_fopen(&file, FOpenWrite | FOpenBin);
          339  +	if (fd && text->length == fwrite(text->str, 1, text->length, fd) &&
          340  +		!ferror(fd) && !fflush(fd))
          341  +	{
          342  +		log_msg(_("%s saved\n"), path);
          343  +	} else {
          344  +		log_file_error(path);
          345  +		res = -1;
          346  +	}
          347  +	if (fd) fclose(fd);
          348  +	file_cleanup(&file);
          349  +	return res;
          350  +}
          351  +
          352  +/**
          353  + * Save torrent file.
          354  + *
          355  + * @param info information about the hashed file
          356  + */
          357  +static void save_torrent(struct file_info* info)
          358  +{
          359  +	/* append .torrent extension to the file path */
          360  +	char* path = str_append(info->full_path, ".torrent");
          361  +	save_torrent_to(path, info->rctx);
          362  +	free(path);
          363  +}
          364  +
          365  +/**
          366  + * Calculate and print file hash sums using printf format.
          367  + *
          368  + * @param out a stream to print to
          369  + * @param file the file to calculate sums for
          370  + * @param print_path the path to print
          371  + * @return 0 on success, -1 on fail
          372  + */
          373  +int calculate_and_print_sums(FILE* out, file_t* file, const char *print_path)
          374  +{
          375  +	struct file_info info;
          376  +	timedelta_t timer;
          377  +	int res = 0;
          378  +
          379  +	memset(&info, 0, sizeof(info));
          380  +	info.file = file;
          381  +	info.full_path = rsh_strdup(file->path);
          382  +	file_info_set_print_path(&info, print_path);
          383  +	info.size = 0;
          384  +
          385  +	info.sums_flags = opt.sum_flags;
          386  +
          387  +	if (file->mode & FILE_IFSTDIN) {
          388  +		print_path = "(stdin)";
          389  +	} else {
          390  +		if (file->mode & FILE_IFDIR) return 0; /* don't handle directories */
          391  +		info.size = file->size; /* total size, in bytes */
          392  +	}
          393  +
          394  +	/* initialize percents output */
          395  +	init_percents(&info);
          396  +	rsh_timer_start(&timer);
          397  +
          398  +	if (info.sums_flags) {
          399  +		/* calculate sums */
          400  +		if (calc_sums(&info) < 0) {
          401  +			/* print i/o error */
          402  +			log_file_t_error(file);
          403  +			res = -1;
          404  +		}
          405  +		if (rhash_data.interrupted) {
          406  +			report_interrupted();
          407  +			return 0;
          408  +		}
          409  +	}
          410  +
          411  +	info.time = rsh_timer_stop(&timer);
          412  +	finish_percents(&info, res);
          413  +
          414  +	if (opt.flags & OPT_EMBED_CRC) {
          415  +		/* rename the file */
          416  +		rename_file_by_embeding_crc32(&info);
          417  +	}
          418  +
          419  +	if ((opt.mode & MODE_TORRENT) && !opt.bt_batch_file) {
          420  +		save_torrent(&info);
          421  +	}
          422  +
          423  +	if ((opt.mode & MODE_UPDATE) && opt.fmt == FMT_SFV) {
          424  +		/* updating SFV file: print SFV header line */
          425  +		print_sfv_header_line(rhash_data.upd_fd, file, 0);
          426  +		if (opt.flags & OPT_VERBOSE) {
          427  +			print_sfv_header_line(rhash_data.log, file, 0);
          428  +			fflush(rhash_data.log);
          429  +		}
          430  +		file_cleanup(file);
          431  +	}
          432  +
          433  +	if (rhash_data.print_list && res >= 0) {
          434  +		if (!opt.bt_batch_file) {
          435  +			print_line(out, rhash_data.print_list, &info);
          436  +
          437  +			/* print calculated line to stderr or log-file if verbose */
          438  +			if ((opt.mode & MODE_UPDATE) && (opt.flags & OPT_VERBOSE)) {
          439  +				print_line(rhash_data.log, rhash_data.print_list, &info);
          440  +			}
          441  +		}
          442  +
          443  +		if ((opt.flags & OPT_SPEED) && info.sums_flags) {
          444  +			print_file_time_stats(&info);
          445  +		}
          446  +	}
          447  +	free(info.full_path);
          448  +	file_info_destroy(&info);
          449  +	return res;
          450  +}
          451  +
          452  +/**
          453  + * Verify hash sums of the file.
          454  + *
          455  + * @param info structure file path to process
          456  + * @return zero on success, -1 on file error, -2 if hash sums are different
          457  + */
          458  +static int verify_sums(struct file_info *info)
          459  +{
          460  +	timedelta_t timer;
          461  +	int res = 0;
          462  +	errno = 0;
          463  +
          464  +	/* initialize percents output */
          465  +	init_percents(info);
          466  +	rsh_timer_start(&timer);
          467  +
          468  +	if (calc_sums(info) < 0) {
          469  +		finish_percents(info, -1);
          470  +		return -1;
          471  +	}
          472  +	info->time = rsh_timer_stop(&timer);
          473  +
          474  +	if (rhash_data.interrupted) {
          475  +		report_interrupted();
          476  +		return 0;
          477  +	}
          478  +
          479  +	if ((opt.flags & OPT_EMBED_CRC) && find_embedded_crc32(
          480  +		info->print_path, &info->hc.embedded_crc32)) {
          481  +			info->hc.flags |= HC_HAS_EMBCRC32;
          482  +			assert(info->hc.hash_mask & RHASH_CRC32);
          483  +	}
          484  +
          485  +	if (!hash_check_verify(&info->hc, info->rctx)) {
          486  +		res = -2;
          487  +	}
          488  +
          489  +	finish_percents(info, res);
          490  +
          491  +	if ((opt.flags & OPT_SPEED) && info->sums_flags) {
          492  +		print_file_time_stats(info);
          493  +	}
          494  +	return res;
          495  +}
          496  +
          497  +/**
          498  + * Check hash sums in a hash file.
          499  + * Lines beginning with ';' and '#' are ignored.
          500  + *
          501  + * @param hash_file_path - the path of the file with hash sums to verify.
          502  + * @param chdir - true if function should emulate chdir to directory of filepath before checking it.
          503  + * @return zero on success, -1 on fail
          504  + */
          505  +int check_hash_file(file_t* file, int chdir)
          506  +{
          507  +	FILE *fd;
          508  +	char buf[2048];
          509  +	size_t pos;
          510  +	const char *ralign;
          511  +	timedelta_t timer;
          512  +	struct file_info info;
          513  +	const char* hash_file_path = file->path;
          514  +	int res = 0, line_num = 0;
          515  +	double time;
          516  +
          517  +	/* process --check-embedded option */
          518  +	if (opt.mode & MODE_CHECK_EMBEDDED) {
          519  +		unsigned crc32;
          520  +		if (find_embedded_crc32(hash_file_path, &crc32)) {
          521  +			/* initialize file_info structure */
          522  +			memset(&info, 0, sizeof(info));
          523  +			info.full_path = rsh_strdup(hash_file_path);
          524  +			info.file = file;
          525  +			file_info_set_print_path(&info, info.full_path);
          526  +			info.sums_flags = info.hc.hash_mask = RHASH_CRC32;
          527  +			info.hc.flags = HC_HAS_EMBCRC32;
          528  +			info.hc.embedded_crc32 = crc32;
          529  +
          530  +			res = verify_sums(&info);
          531  +			fflush(rhash_data.out);
          532  +			if (!rhash_data.interrupted) {
          533  +				if (res == 0) rhash_data.ok++;
          534  +				else if (res == -1 && errno == ENOENT) rhash_data.miss++;
          535  +				rhash_data.processed++;
          536  +			}
          537  +
          538  +			free(info.full_path);
          539  +			file_info_destroy(&info);
          540  +		} else {
          541  +			log_warning(_("file name doesn't contain a CRC32: %s\n"), hash_file_path);
          542  +			return -1;
          543  +		}
          544  +		return 0;
          545  +	}
          546  +
          547  +	/* initialize statistics */
          548  +	rhash_data.processed = rhash_data.ok = rhash_data.miss = 0;
          549  +	rhash_data.total_size = 0;
          550  +
          551  +	if (file->mode & FILE_IFSTDIN) {
          552  +		fd = stdin;
          553  +		hash_file_path = "<stdin>";
          554  +	} else if ( !(fd = file_fopen(file, FOpenRead | FOpenBin) )) {
          555  +		log_file_error(hash_file_path);
          556  +		return -1;
          557  +	}
          558  +
          559  +	pos = strlen(hash_file_path)+16;
          560  +	ralign = str_set(buf, '-', (pos < 80 ? 80 - (int)pos : 2));
          561  +	rsh_fprintf(rhash_data.out, _("\n--( Verifying %s )%s\n"), hash_file_path, ralign);
          562  +	fflush(rhash_data.out);
          563  +	rsh_timer_start(&timer);
          564  +
          565  +	/* mark the directory part of the path, by setting the pos index */
          566  +	if (chdir) {
          567  +		pos = strlen(hash_file_path);
          568  +		for (; pos > 0 && !IS_PATH_SEPARATOR(hash_file_path[pos]); pos--);
          569  +		if (IS_PATH_SEPARATOR(hash_file_path[pos])) pos++;
          570  +	} else pos = 0;
          571  +
          572  +	/* read crc file line by line */
          573  +	for (line_num = 0; fgets(buf, 2048, fd); line_num++) {
          574  +		char* line = buf;
          575  +		char* path_without_ext = NULL;
          576  +
          577  +		/* skip unicode BOM */
          578  +		if (line_num == 0 && buf[0] == (char)0xEF && buf[1] == (char)0xBB && buf[2] == (char)0xBF) line += 3;
          579  +
          580  +		if (*line == 0) continue; /* skip empty lines */
          581  +
          582  +		if (is_binary_string(line)) {
          583  +			log_error(_("file is binary: %s\n"), hash_file_path);
          584  +			if (fd != stdin) fclose(fd);
          585  +			return -1;
          586  +		}
          587  +
          588  +		/* skip comments and empty lines */
          589  +		if (IS_COMMENT(*line) || *line == '\r' || *line == '\n') continue;
          590  +
          591  +		memset(&info, 0, sizeof(info));
          592  +
          593  +		if (!hash_check_parse_line(line, &info.hc, !feof(fd))) continue;
          594  +		if (info.hc.hash_mask == 0) continue;
          595  +
          596  +		info.print_path = info.hc.file_path;
          597  +		info.sums_flags = info.hc.hash_mask;
          598  +
          599  +		/* see if crc file contains a hash sum without a filename */
          600  +		if (info.print_path == NULL) {
          601  +			char* point;
          602  +			path_without_ext = rsh_strdup(hash_file_path);
          603  +			point = strrchr(path_without_ext, '.');
          604  +
          605  +			if (point) {
          606  +				*point = '\0';
          607  +				file_info_set_print_path(&info, path_without_ext);
          608  +			}
          609  +		}
          610  +
          611  +		if (info.print_path != NULL) {
          612  +			file_t file_to_check;
          613  +			int is_absolute = IS_PATH_SEPARATOR(info.print_path[0]);
          614  +			IF_WINDOWS(is_absolute = is_absolute || (info.print_path[0] && info.print_path[1] == ':'));
          615  +
          616  +			/* if filename shall be prepended by a directory path */
          617  +			if (pos && !is_absolute) {
          618  +				size_t len = strlen(info.print_path);
          619  +				info.full_path = (char*)rsh_malloc(pos + len + 1);
          620  +				memcpy(info.full_path, hash_file_path, pos);
          621  +				strcpy(info.full_path + pos, info.print_path);
          622  +			} else {
          623  +				info.full_path = rsh_strdup(info.print_path);
          624  +			}
          625  +			memset(&file_to_check, 0, sizeof(file_t));
          626  +			file_to_check.path = info.full_path;
          627  +			file_stat(&file_to_check, 0);
          628  +			info.file = &file_to_check;
          629  +
          630  +			/* verify hash sums of the file */
          631  +			res = verify_sums(&info);
          632  +
          633  +			fflush(rhash_data.out);
          634  +			file_cleanup(&file_to_check);
          635  +			file_info_destroy(&info);
          636  +
          637  +			if (rhash_data.interrupted) {
          638  +				free(path_without_ext);
          639  +				break;
          640  +			}
          641  +
          642  +			/* update statistics */
          643  +			if (res == 0) rhash_data.ok++;
          644  +			else if (res == -1 && errno == ENOENT) rhash_data.miss++;
          645  +			rhash_data.processed++;
          646  +		}
          647  +		free(path_without_ext);
          648  +	}
          649  +	time = rsh_timer_stop(&timer);
          650  +
          651  +	rsh_fprintf(rhash_data.out, "%s\n", str_set(buf, '-', 80));
          652  +	print_check_stats();
          653  +
          654  +	if (rhash_data.processed != rhash_data.ok) rhash_data.error_flag = 1;
          655  +
          656  +	if (opt.flags & OPT_SPEED && rhash_data.processed > 1) {
          657  +		print_time_stats(time, rhash_data.total_size, 1);
          658  +	}
          659  +
          660  +	rhash_data.processed = 0;
          661  +	res = ferror(fd); /* check that crc file has been read without errors */
          662  +	if (fd != stdin) fclose(fd);
          663  +	return (res == 0 ? 0 : -1);
          664  +}
          665  +
          666  +/*=========================================================================
          667  + * Benchmark functions
          668  + *=========================================================================*/
          669  +
          670  +/**
          671  + * Hash a repeated message chunk by specified hash function.
          672  + *
          673  + * @param hash_id hash function identifier
          674  + * @param message a message chunk to hash
          675  + * @param msg_size message chunk size
          676  + * @param count number of chunks
          677  + * @param out computed hash
          678  + * @return 1 on success, 0 on error
          679  + */
          680  +static int benchmark_loop(unsigned hash_id, const unsigned char* message, size_t msg_size, int count, unsigned char* out)
          681  +{
          682  +	int i;
          683  +	struct rhash_context *context = rhash_init(hash_id);
          684  +	if (!context) return 0;
          685  +
          686  +	/* process the repeated message buffer */
          687  +	for (i = 0; i < count && !rhash_data.interrupted; i++) {
          688  +		rhash_update(context, message, msg_size);
          689  +	}
          690  +	rhash_final(context, out);
          691  +	rhash_free(context);
          692  +	return 1;
          693  +}
          694  +
          695  +#if defined(_MSC_VER)
          696  +#define ALIGN_DATA(n) __declspec(align(n))
          697  +#elif defined(__GNUC__)
          698  +#define ALIGN_DATA(n) __attribute__((aligned (n)))
          699  +#else
          700  +#define ALIGN_DATA(n) /* do nothing */
          701  +#endif
          702  +
          703  +/* define read_tsc() if possible */
          704  +#if defined(__i386__) || defined(_M_IX86) || \
          705  +	defined(__x86_64__) || defined(_M_AMD64) || defined(_M_X64)
          706  +
          707  +#if defined( _MSC_VER ) /* if MS VC */
          708  +# include <intrin.h>
          709  +# pragma intrinsic( __rdtsc )
          710  +# define read_tsc() __rdtsc()
          711  +# define HAVE_TSC
          712  +#elif defined( __GNUC__ ) /* if GCC */
          713  +static uint64_t read_tsc(void) {
          714  +	unsigned long lo, hi;
          715  +	__asm volatile("rdtsc" : "=a" (lo), "=d" (hi));
          716  +	return (((uint64_t)hi) << 32) + lo;
          717  +}
          718  +# define HAVE_TSC
          719  +#endif /* _MSC_VER, __GNUC__ */
          720  +#endif /* x86/amd64 arch */
          721  +
          722  +void run_benchmark(unsigned hash_id, unsigned flags)
          723  +{
          724  +	unsigned char ALIGN_DATA(16) message[8192]; /* 8 KiB */
          725  +	timedelta_t timer;
          726  +	int i, j;
          727  +	size_t sz_mb, msg_size;
          728  +	double time, total_time = 0;
          729  +	const int rounds = 4;
          730  +	const char* hash_name;
          731  +	unsigned char out[130];
          732  +#ifdef HAVE_TSC
          733  +	double cpb = 0;
          734  +#endif /* HAVE_TSC */
          735  +
          736  +#ifdef _WIN32
          737  +	set_benchmark_cpu_affinity(); /* set CPU affinity to improve test results */
          738  +#endif
          739  +
          740  +	/* set message size for fast and slow hash functions */
          741  +	msg_size = 1073741824 / 2;
          742  +	if (hash_id & (RHASH_WHIRLPOOL | RHASH_SNEFRU128 | RHASH_SNEFRU256 | RHASH_SHA3_224 | RHASH_SHA3_256 | RHASH_SHA3_384 | RHASH_SHA3_512)) {
          743  +		msg_size /= 8;
          744  +	} else if (hash_id & (RHASH_GOST | RHASH_GOST_CRYPTOPRO | RHASH_SHA384 | RHASH_SHA512)) {
          745  +		msg_size /= 2;
          746  +	}
          747  +	sz_mb = msg_size / (1 << 20); /* size in MiB */
          748  +	hash_name = rhash_get_name(hash_id);
          749  +	if (!hash_name) hash_name = ""; /* benchmarking several hashes*/
          750  +
          751  +	for (i = 0; i < (int)sizeof(message); i++) message[i] = i & 0xff;
          752  +
          753  +	for (j = 0; j < rounds && !rhash_data.interrupted; j++) {
          754  +		rsh_timer_start(&timer);
          755  +		benchmark_loop(hash_id, message, sizeof(message), (int)(msg_size / sizeof(message)), out);
          756  +
          757  +		time = rsh_timer_stop(&timer);
          758  +		total_time += time;
          759  +
          760  +		if ((flags & BENCHMARK_RAW) == 0 && !rhash_data.interrupted) {
          761  +			rsh_fprintf(rhash_data.out, "%s %u MiB calculated in %.3f sec, %.3f MBps\n", hash_name, (unsigned)sz_mb, time, (double)sz_mb / time);
          762  +			fflush(rhash_data.out);
          763  +		}
          764  +	}
          765  +
          766  +#if defined(HAVE_TSC)
          767  +	/* measure the CPU "clocks per byte" speed */
          768  +	if ((flags & BENCHMARK_CPB) != 0 && !rhash_data.interrupted) {
          769  +		unsigned int c1 = -1, c2 = -1;
          770  +		unsigned volatile long long cy0, cy1, cy2;
          771  +		int msg_size = 128 * 1024;
          772  +
          773  +		/* make 200 tries */
          774  +		for (i = 0; i < 200; i++) {
          775  +			cy0 = read_tsc();
          776  +			benchmark_loop(hash_id, message, sizeof(message), msg_size / sizeof(message), out);
          777  +			cy1 = read_tsc();
          778  +			benchmark_loop(hash_id, message, sizeof(message), msg_size / sizeof(message), out);
          779  +			benchmark_loop(hash_id, message, sizeof(message), msg_size / sizeof(message), out);
          780  +			cy2 = read_tsc();
          781  +
          782  +			cy2 -= cy1;
          783  +			cy1 -= cy0;
          784  +			c1 = (unsigned int)(c1 > cy1 ? cy1 : c1);
          785  +			c2 = (unsigned int)(c2 > cy2 ? cy2 : c2);
          786  +		}
          787  +		cpb = ((c2 - c1) + 1) / (double)msg_size;
          788  +	}
          789  +#endif /* HAVE_TSC */
          790  +
          791  +	if (rhash_data.interrupted) {
          792  +		report_interrupted();
          793  +		return;
          794  +	}
          795  +
          796  +	if (flags & BENCHMARK_RAW) {
          797  +		/* output result in a "raw" machine-readable format */
          798  +		rsh_fprintf(rhash_data.out, "%s\t%u\t%.3f\t%.3f", hash_name, ((unsigned)sz_mb * rounds), total_time, (double)(sz_mb * rounds) / total_time);
          799  +#if defined(HAVE_TSC)
          800  +		if (flags & BENCHMARK_CPB) {
          801  +			rsh_fprintf(rhash_data.out, "\t%.2f", cpb);
          802  +		}
          803  +#endif /* HAVE_TSC */
          804  +		rsh_fprintf(rhash_data.out, "\n");
          805  +	} else {
          806  +		rsh_fprintf(rhash_data.out, "%s %u MiB total in %.3f sec, %.3f MBps", hash_name, ((unsigned)sz_mb * rounds), total_time, (double)(sz_mb * rounds) / total_time);
          807  +#if defined(HAVE_TSC)
          808  +		if (flags & BENCHMARK_CPB) {
          809  +			rsh_fprintf(rhash_data.out, ", CPB=%.2f", cpb);
          810  +		}
          811  +#endif /* HAVE_TSC */
          812  +		rsh_fprintf(rhash_data.out, "\n");
          813  +	}
          814  +}

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/calc_sums.h version [b8145e8121].

            1  +/* calc_sums.h */
            2  +#ifndef CALC_SUMS_H
            3  +#define CALC_SUMS_H
            4  +
            5  +#include <stdint.h>
            6  +#include "common_func.h"
            7  +#include "hash_check.h"
            8  +
            9  +#ifdef __cplusplus
           10  +extern "C" {
           11  +#endif
           12  +
           13  +struct file_t;
           14  +
           15  +/**
           16  + * Information about a file to calculate/verify hashes for.
           17  + */
           18  +struct file_info {
           19  +	/* the file path (in system encoding). It can be changed
           20  +	 * if a crc sum is embedded into the filename. */
           21  +	char* full_path;
           22  +	const char* print_path; /* the part of the path for printing */
           23  +	char* utf8_print_path;  /* file path in UTF8 */
           24  +	uint64_t size;          /* the size of the hashed file */
           25  +	uint64_t msg_offset;    /* rctx->msg_size before hashing this file */
           26  +	double time;            /* file processing time in seconds */
           27  +	struct file_t* file;    /* the file being processed */
           28  +	struct rhash_context* rctx; /* state of hash algorithms */
           29  +	int error;  /* -1 for i/o error, -2 for wrong sum, 0 on success */
           30  +	char* allocated_ptr;
           31  +
           32  +	unsigned sums_flags; /* mask of ids of calculated hash functions */
           33  +	struct hash_check hc; /* hash values parsed from a hash file */
           34  +};
           35  +
           36  +void file_info_destroy(struct file_info*); /* free allocated memory */
           37  +const char* file_info_get_utf8_print_path(struct file_info*);
           38  +
           39  +int save_torrent_to(const char* path, struct rhash_context* rctx);
           40  +int calculate_and_print_sums(FILE* out, struct file_t* file, const char *print_path);
           41  +int check_hash_file(struct file_t* file, int chdir);
           42  +int rename_file_by_embeding_crc32(struct file_info *info);
           43  +
           44  +/* Benchmarking */
           45  +
           46  +/** Benchmarking flag: measure the CPU "clocks per byte" speed */
           47  +#define BENCHMARK_CPB 1
           48  +/** Benchmarking flag: print benchmark result in tab-delimited format */
           49  +#define BENCHMARK_RAW 2
           50  +
           51  +/**
           52  + * Benchmark a hash algorithm.
           53  + *
           54  + * @param hash_id hash algorithm identifier
           55  + * @param flags benchmark flags, can contain BENCHMARK_CPB, BENCHMARK_RAW
           56  + */
           57  +void run_benchmark(unsigned hash_id, unsigned flags);
           58  +
           59  +#ifdef __cplusplus
           60  +} /* extern "C" */
           61  +#endif /* __cplusplus */
           62  +
           63  +#endif /* CALC_SUMS_H */

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/common_func.c version [2fb040ee1c].

            1  +/* common_func.c - functions used almost everywhere */
            2  +
            3  +#include <assert.h>
            4  +#include <ctype.h>
            5  +#include <errno.h>
            6  +#include <stdarg.h>
            7  +#include <stdlib.h>
            8  +#include <string.h>
            9  +#include <wchar.h>
           10  +
           11  +#if defined( _WIN32) || defined(__CYGWIN__)
           12  +# include <windows.h>
           13  +#endif
           14  +
           15  +#include "common_func.h"
           16  +#include "parse_cmdline.h"
           17  +#include "version.h"
           18  +#include "win_utils.h"
           19  +
           20  +/*=========================================================================
           21  + * String functions
           22  + *=========================================================================*/
           23  +
           24  +/**
           25  + * Print a 0-terminated string representation of a 64-bit number to
           26  + * a string buffer.
           27  + *
           28  + * @param dst the string buffer to write the number to
           29  + * @param number the 64-bit number to output
           30  + * @param min_width the minimum width, the number must take
           31  + */
           32  +void sprintI64(char *dst, uint64_t number, int min_width)
           33  +{
           34  +	char buf[24]; /* internal buffer to output the number to */
           35  +	size_t len;
           36  +	char *p = buf + 23; /* start filling from the buffer end */
           37  +	*(p--) = 0; /* last symbol should be '\0' */
           38  +	if (number == 0) {
           39  +		*(p--) = '0';
           40  +	} else {
           41  +		for (; p >= buf && number != 0; p--, number /= 10) {
           42  +			*p = '0' + (char)(number % 10);
           43  +		}
           44  +	}
           45  +	len = buf + 22 - p;
           46  +	if ((size_t)min_width > len) {
           47  +		memset(dst, 0x20, min_width - len); /* fill by spaces */
           48  +		dst += min_width - len;
           49  +	}
           50  +	memcpy(dst, p+1, len+1); /* copy the number to the output buffer */
           51  +}
           52  +
           53  +/**
           54  + * Calculate length of decimal representation of given 64-bit integer.
           55  + *
           56  + * @param num integer to calculate the length for
           57  + * @return length of decimal representation
           58  + */
           59  +int int_len(uint64_t num)
           60  +{
           61  +	int len;
           62  +	for (len = 0; num; len++, num /= 10);
           63  +	return (len == 0 ? 1 : len); /* note: int_len(0) == 1 */
           64  +}
           65  +
           66  +/**
           67  + * Convert a byte to a hexadecimal string. The result, consisting of two
           68  + * hexadecimal digits is stored into a buffer.
           69  + *
           70  + * @param dst  the buffer to receive two symbols of hex representation
           71  + * @param byte the byte to decode
           72  + * @param upper_case flag to print string in uppercase
           73  + * @return pointer to the next char in buffer (dst+2)
           74  + */
           75  +static char* print_hex_byte(char *dst, const unsigned char byte, int upper_case)
           76  +{
           77  +	const char add = (upper_case ? 'A' - 10 : 'a' - 10);
           78  +	unsigned char c = (byte >> 4) & 15;
           79  +	*dst++ = (c > 9 ? c + add : c + '0');
           80  +	c = byte & 15;
           81  +	*dst++ = (c > 9 ? c + add : c + '0');
           82  +	return dst;
           83  +}
           84  +
           85  +/* unsafe characters are "<>{}[]%#/|\^~`@:;?=&+ */
           86  +#define IS_GOOD_URL_CHAR(c) (isalnum((unsigned char)c) || strchr("$-_.!'(),", c))
           87  +
           88  +/**
           89  + * URL-encode a string.
           90  + *
           91  + * @param dst buffer to receive result or NULL to calculate
           92  + *    the lengths of encoded string
           93  + * @param filename the file name
           94  + * @return the length of the result string
           95  + */
           96  +int urlencode(char *dst, const char *name)
           97  +{
           98  +	const char *start;
           99  +	if (!dst) {
          100  +		int len;
          101  +		for (len = 0; *name; name++) len += (IS_GOOD_URL_CHAR(*name) ? 1 : 3);
          102  +		return len;
          103  +	}
          104  +	/* encode URL as specified by RFC 1738 */
          105  +	for (start = dst; *name; name++) {
          106  +		if ( IS_GOOD_URL_CHAR(*name) ) {
          107  +			*dst++ = *name;
          108  +		} else {
          109  +			*dst++ = '%';
          110  +			dst = print_hex_byte(dst, *name, 'A');
          111  +		}
          112  +	}
          113  +	*dst = 0;
          114  +	return (int)(dst - start);
          115  +}
          116  +
          117  +/**
          118  + * Convert given string to lower case.
          119  + * The result string will be allocated by malloc.
          120  + * The allocated memory should be freed by calling free().
          121  + *
          122  + * @param str a string to convert
          123  + * @return converted string allocated by malloc
          124  + */
          125  +char* str_tolower(const char* str)
          126  +{
          127  +	char* buf = rsh_strdup(str);
          128  +	char* p;
          129  +	if (buf) {
          130  +		for (p = buf; *p; p++) *p = tolower(*p);
          131  +	}
          132  +	return buf;
          133  +}
          134  +
          135  +/**
          136  + * Remove spaces from the begin and the end of the string.
          137  + *
          138  + * @param str the modifiable buffer with the string
          139  + * @return trimmed string
          140  + */
          141  +char* str_trim(char* str)
          142  +{
          143  +	char* last = str + strlen(str) - 1;
          144  +	while (isspace((unsigned char)*str)) str++;
          145  +	while (isspace((unsigned char)*last) && last > str) *(last--) = 0;
          146  +	return str;
          147  +}
          148  +
          149  +/**
          150  + * Fill a buffer with NULL-terminated string consisting
          151  + * solely of a given repeated character.
          152  + *
          153  + * @param buf  the modifiable buffer to fill
          154  + * @param ch   the character to fill string with
          155  + * @param length the length of the string to construct
          156  + * @return the buffer
          157  + */
          158  +char* str_set(char* buf, int ch, int length)
          159  +{
          160  +	memset(buf, ch, length);
          161  +	buf[length] = '\0';
          162  +	return buf;
          163  +}
          164  +
          165  +/**
          166  + * Concatenates two strings and returns allocated buffer with result.
          167  + *
          168  + * @param orig original string
          169  + * @param append the string to append
          170  + * @return the buffer
          171  + */
          172  +char* str_append(const char* orig, const char* append)
          173  +{
          174  +	size_t len1 = strlen(orig);
          175  +	size_t len2 = strlen(append);
          176  +	char* res = (char*)rsh_malloc(len1 + len2 + 1);
          177  +
          178  +	/* concatenate two strings */
          179  +	memcpy(res, orig, len1);
          180  +	memcpy(res + len1, append, len2 + 1);
          181  +	return res;
          182  +}
          183  +
          184  +/**
          185  + * Check if a string is a binary string, which means the string contain
          186  + * a character with ACII code below 0x20 other than '\r', '\n', '\t'.
          187  + *
          188  + * @param str a string to check
          189  + * @return non zero if string is binary
          190  + */
          191  +int is_binary_string(const char* str)
          192  +{
          193  +	for (; *str; str++) {
          194  +		if (((unsigned char)*str) < 32 && ((1 << (unsigned char)*str) & ~0x2600)) {
          195  +			return 1;
          196  +		}
          197  +	}
          198  +	return 0;
          199  +}
          200  +
          201  +/**
          202  + * Count number of utf8 characters in a 0-terminated string
          203  + *
          204  + * @param str the string to measure
          205  + * @return number of utf8 characters in the string
          206  + */
          207  +size_t strlen_utf8_c(const char *str)
          208  +{
          209  +	size_t length = 0;
          210  +	for (; *str; str++) {
          211  +		if ((*str & 0xc0) != 0x80) length++;
          212  +	}
          213  +	return length;
          214  +}
          215  +
          216  +/*=========================================================================
          217  +* Program version information
          218  +*=========================================================================*/
          219  +
          220  +const char* get_version_string(void)
          221  +{
          222  +	static const char* version_string = VERSION;
          223  +	return version_string;
          224  +}
          225  +
          226  +const char* get_bt_program_name(void)
          227  +{
          228  +	static const char* bt_program_name = PROGRAM_NAME "/" VERSION;
          229  +	return bt_program_name;
          230  +}
          231  +
          232  +/*=========================================================================
          233  + * Timer functions
          234  + *=========================================================================*/
          235  +
          236  +/**
          237  + * Return real-value representing number of seconds
          238  + * stored in the given timeval structure.
          239  + * The function is used with timers, when printing time statistics.
          240  + *
          241  + * @param delta time delta to be converted
          242  + * @return number of seconds
          243  + */
          244  +static double rsh_fsec(timedelta_t* timer)
          245  +{
          246  +#if defined( _WIN32) || defined(__CYGWIN__)
          247  +	LARGE_INTEGER freq;
          248  +	QueryPerformanceFrequency(&freq);
          249  +	return (double)*timer / freq.QuadPart;
          250  +#else
          251  +	return ((double)timer->tv_usec / 1000000.0) + timer->tv_sec;
          252  +#endif
          253  +}
          254  +
          255  +#if defined( _WIN32) || defined(__CYGWIN__)
          256  +#define get_timedelta(delta) QueryPerformanceCounter((LARGE_INTEGER*)delta)
          257  +#else
          258  +#define get_timedelta(delta) gettimeofday(delta, NULL)
          259  +#endif
          260  +
          261  +void rsh_timer_start(timedelta_t* timer)
          262  +{
          263  +	get_timedelta(timer);
          264  +}
          265  +
          266  +double rsh_timer_stop(timedelta_t* timer)
          267  +{
          268  +	timedelta_t end;
          269  +	get_timedelta(&end);
          270  +#if defined( _WIN32) || defined(__CYGWIN__)
          271  +	*timer = end - *timer;
          272  +#else
          273  +	timer->tv_sec  = end.tv_sec  - timer->tv_sec - (end.tv_usec >= timer->tv_usec ? 0 : 1);
          274  +	timer->tv_usec = end.tv_usec + (end.tv_usec >= timer->tv_usec ? 0 : 1000000 ) - timer->tv_usec;
          275  +#endif
          276  +	return rsh_fsec(timer);
          277  +}
          278  +
          279  +unsigned rhash_get_ticks(void)
          280  +{
          281  +#if defined( _WIN32) || defined(__CYGWIN__)
          282  +	return GetTickCount();
          283  +#else
          284  +	struct timeval tv;
          285  +	gettimeofday(&tv, NULL);
          286  +	return (tv.tv_sec * 1000 + tv.tv_usec / 1000);
          287  +#endif
          288  +}
          289  +
          290  +/*=========================================================================
          291  + * Custom program exit function
          292  + *=========================================================================*/
          293  +
          294  +struct rhash_exit_handlers_t
          295  +{
          296  +	unsigned handlers_count;
          297  +	exit_handler_t handlers[4];
          298  +} rhash_exit_handlers = { 0, { 0 } };
          299  +
          300  +/**
          301  +* Install a handler to be called on program exit.
          302  +*
          303  +* @param handler the hadler to add
          304  +*/
          305  +void rsh_install_exit_handler(exit_handler_t handler)
          306  +{
          307  +	if (rhash_exit_handlers.handlers_count >= (sizeof(rhash_exit_handlers.handlers) / sizeof(rhash_exit_handlers.handlers[0])))
          308  +	{
          309  +		assert(!"to many handlers");
          310  +		rsh_exit(2);
          311  +	}
          312  +	rhash_exit_handlers.handlers[rhash_exit_handlers.handlers_count] = handler;
          313  +	rhash_exit_handlers.handlers_count++;
          314  +}
          315  +
          316  +/**
          317  +* Remove the last installed exit handler.
          318  +*/
          319  +void rsh_remove_exit_handler(void)
          320  +{
          321  +	if (rhash_exit_handlers.handlers_count == 0)
          322  +	{
          323  +		assert(rhash_exit_handlers.handlers_count > 0 && "no handlers installed");
          324  +		rsh_exit(2);
          325  +	}
          326  +	rhash_exit_handlers.handlers_count--;
          327  +}
          328  +
          329  +/**
          330  +* Call all installed exit handlers, starting from the latest one, and exit the program.
          331  +*
          332  +* @param code the program exit code
          333  +*/
          334  +void rsh_exit(int code)
          335  +{
          336  +	while (rhash_exit_handlers.handlers_count > 0)
          337  +		rhash_exit_handlers.handlers[--rhash_exit_handlers.handlers_count]();
          338  +	exit(code);
          339  +}
          340  +
          341  +/*=========================================================================
          342  + * Error reporting functions
          343  + *=========================================================================*/
          344  +
          345  +static void report_error_default(const char* srcfile, int srcline,
          346  +	const char* format, ...);
          347  +
          348  +void (*rsh_report_error)(const char* srcfile, int srcline,
          349  +	const char* format, ...) = report_error_default;
          350  +
          351  +/**
          352  + * Print given library failure to stderr.
          353  + *
          354  + * @param srcfile source file to report error on fail
          355  + * @param srcline source code line to be reported on fail
          356  + * @param format printf-formatted error message
          357  + */
          358  +static void report_error_default(const char* srcfile, int srcline, const char* format, ...)
          359  +{
          360  +	va_list ap;
          361  +	rsh_fprintf(stderr, "RHash: error at %s:%u: ", srcfile, srcline);
          362  +	va_start(ap, format);
          363  +	rsh_vfprintf(stderr, format, ap); /* report the error to stderr */
          364  +	va_end(ap);
          365  +}
          366  +
          367  +/*=========================================================================
          368  + * Memory functions
          369  + *=========================================================================*/
          370  +
          371  +/**
          372  + * Allocates a buffer via malloc with reporting memory error to stderr.
          373  + *
          374  + * @param size size of the block to allocate
          375  + * @param srcfile source file to report error on fail
          376  + * @param srcline source code line to be reported on fail
          377  + * @return allocated block
          378  + */
          379  +void* rhash_malloc(size_t size, const char* srcfile, int srcline)
          380  +{
          381  +	void* res = malloc(size);
          382  +	if (!res) {
          383  +		rsh_report_error(srcfile, srcline, "%s(%u) failed\n", "malloc", (unsigned)size);
          384  +		rsh_exit(2);
          385  +	}
          386  +	return res;
          387  +}
          388  +
          389  +/**
          390  + * Allocates a buffer via calloc with reporting memory error to stderr.
          391  + *
          392  + * @param num number of elements to be allocated
          393  + * @param size size of elements
          394  + * @param srcfile source file to report error on fail
          395  + * @param srcline source code line to be reported on fail
          396  + * @return allocated block
          397  + */
          398  +void* rhash_calloc(size_t num, size_t size, const char* srcfile, int srcline)
          399  +{
          400  +	void* res = calloc(num, size);
          401  +	if (!res) {
          402  +		rsh_report_error(srcfile, srcline, "calloc(%u, %u) failed\n", (unsigned)num, (unsigned)size);
          403  +		rsh_exit(2);
          404  +	}
          405  +	return res;
          406  +}
          407  +
          408  +
          409  +/**
          410  + * Duplicate c-string with reporting memory error to stderr.
          411  + *
          412  + * @param str the zero-terminated string to duplicate
          413  + * @param srcfile source file to report error on fail
          414  + * @param srcline source code line to be reported on fail
          415  + * @return allocated memory buffer with copied string
          416  + */
          417  +char* rhash_strdup(const char* str, const char* srcfile, int srcline)
          418  +{
          419  +#ifndef __STRICT_ANSI__
          420  +	char* res = strdup(str);
          421  +#else
          422  +	char* res = (char*)malloc(strlen(str)+1);
          423  +	if (res) strcpy(res, str);
          424  +#endif
          425  +
          426  +	if (!res) {
          427  +		rsh_report_error(srcfile, srcline, "strdup(\"%s\") failed\n", str);
          428  +		rsh_exit(2);
          429  +	}
          430  +	return res;
          431  +}
          432  +
          433  +#ifdef _WIN32
          434  +/**
          435  + * Duplicate wide string with reporting memory error to stderr.
          436  + *
          437  + * @param str the zero-terminated string to duplicate
          438  + * @param srcfile source file to report error on fail
          439  + * @param srcline source code line to be reported on fail
          440  + * @return allocated memory buffer with copied string
          441  + */
          442  +wchar_t* rhash_wcsdup(const wchar_t* str, const char* srcfile, int srcline)
          443  +{
          444  +#ifndef __STRICT_ANSI__
          445  +	wchar_t* res = wcsdup(str);
          446  +#else
          447  +	wchar_t* res = (wchar_t*)malloc((wcslen(str) + 1) * sizeof(wchar_t));
          448  +	if (res) wcscpy(res, str);
          449  +#endif
          450  +
          451  +	if (!res) {
          452  +		rsh_report_error(srcfile, srcline, "wcsdup(\"%u\") failed\n", (wcslen(str) + 1));
          453  +		rsh_exit(2);
          454  +	}
          455  +	return res;
          456  +}
          457  +#endif
          458  +
          459  +/**
          460  + * Reallocates a buffer via realloc with reporting memory error to stderr.
          461  + *
          462  + * @param mem a memory block to re-allocate
          463  + * @param size the new size of the block
          464  + * @param srcfile source file to report error on fail
          465  + * @param srcline source code line to be reported on fail
          466  + * @return re-allocated memory buffer
          467  + */
          468  +void* rhash_realloc(void* mem, size_t size, const char* srcfile, int srcline)
          469  +{
          470  +	void* res = realloc(mem, size);
          471  +	if (!res) {
          472  +		rsh_report_error(srcfile, srcline, "realloc(%p, %u) failed\n", mem, (unsigned)size);
          473  +		rsh_exit(2);
          474  +	}
          475  +	return res;
          476  +}
          477  +
          478  +/*=========================================================================
          479  + * Containers
          480  + *=========================================================================*/
          481  +
          482  +/**
          483  + * Allocate an empty vector.
          484  + *
          485  + * @param destructor pointer to the cleanup/deallocate function called
          486  + *                   on each element when the vector is destructed,
          487  + *                   NULL if items doesn't need to be freed
          488  + * @return allocated vector
          489  + */
          490  +vector_t* rsh_vector_new(void (*destructor)(void*))
          491  +{
          492  +	vector_t* ptr = (vector_t*)rsh_malloc(sizeof(vector_t));
          493  +	memset(ptr, 0, sizeof(vector_t));
          494  +	ptr->destructor = destructor;
          495  +	return ptr;
          496  +}
          497  +
          498  +/**
          499  + * Allocate an empty vector of pointers to memory blocks,
          500  + * which will be deallocated at destruction time by calling free().
          501  + *
          502  + * @return allocated vector
          503  + */
          504  +struct vector_t* rsh_vector_new_simple(void)
          505  +{
          506  +	return rsh_vector_new(free);
          507  +}
          508  +
          509  +/**
          510  + * Release memory allocated by vector, but the vector structure itself.
          511  + *
          512  + * @param vect the vector to free
          513  + */
          514  +void rsh_vector_destroy(vector_t* vect)
          515  +{
          516  +	if (!vect) return;
          517  +	if (vect->destructor) {
          518  +		unsigned i;
          519  +		for (i=0; i<vect->size; i++) vect->destructor(vect->array[i]);
          520  +	}
          521  +	free(vect->array);
          522  +	vect->size = vect->allocated = 0;
          523  +	vect->array = 0;
          524  +}
          525  +
          526  +/**
          527  + * Release all memory allocated by vector.
          528  + *
          529  + * @param vect the vector to free
          530  + */
          531  +void rsh_vector_free(vector_t* vect)
          532  +{
          533  +	rsh_vector_destroy(vect);
          534  +	free(vect);
          535  +}
          536  +
          537  +/**
          538  + * Add an item to vector.
          539  + *
          540  + * @param vect vector to add item to
          541  + * @param item the item to add
          542  + */
          543  +void rsh_vector_add_ptr(vector_t* vect, void* item)
          544  +{
          545  +	/* check if vect contains enough space for the next item */
          546  +	if (vect->size >= vect->allocated) {
          547  +		size_t size = (vect->allocated==0 ? 128 : vect->allocated * 2);
          548  +		vect->array = (void**)rsh_realloc(vect->array, size * sizeof(void*));
          549  +		vect->allocated = size;
          550  +	}
          551  +	/* add new item to the vector */
          552  +	vect->array[vect->size] = item;
          553  +	vect->size++;
          554  +}
          555  +
          556  +/**
          557  + * Add a sized item to vector.
          558  + *
          559  + * @param vect pointer to the vector to add item to
          560  + * @param item_size the size of a vector item
          561  + */
          562  +void rsh_vector_add_empty(struct vector_t* vect, size_t item_size)
          563  +{
          564  +	/* check if vect contains enough space for next item */
          565  +	if (vect->size >= vect->allocated) {
          566  +		size_t size = (vect->allocated==0 ? 128 : vect->allocated * 2);
          567  +		vect->array = (void**)rsh_realloc(vect->array, size * item_size);
          568  +		vect->allocated = size;
          569  +	}
          570  +	vect->size++;
          571  +}
          572  +
          573  +/**
          574  + * Initialize empty blocks vector.
          575  + *
          576  + * @param bvector pointer to the blocks vector
          577  + */
          578  +void rsh_blocks_vector_init(blocks_vector_t* bvector)
          579  +{
          580  +	memset(bvector, 0, sizeof(*bvector));
          581  +	bvector->blocks.destructor = free;
          582  +}
          583  +
          584  +/**
          585  + * Free memory allocated by blocks vector, the function
          586  + * doesn't deallocate memory additionally allocated for each element.
          587  + *
          588  + * @param bvector pointer to the blocks vector
          589  + */
          590  +void rsh_blocks_vector_destroy(blocks_vector_t* bvector)
          591  +{
          592  +	rsh_vector_destroy(&bvector->blocks);
          593  +}
          594  +
          595  +/*=========================================================================
          596  + * String buffer functions
          597  + *=========================================================================*/
          598  +
          599  +/**
          600  + * Allocate an empty string buffer.
          601  + *
          602  + * @return allocated string buffer
          603  + */
          604  +strbuf_t* rsh_str_new(void)
          605  +{
          606  +	strbuf_t *res = (strbuf_t*)malloc(sizeof(strbuf_t));
          607  +	memset(res, 0, sizeof(strbuf_t));
          608  +	return res;
          609  +}
          610  +
          611  +/**
          612  + * Free memory allocated by string buffer object
          613  + *
          614  + * @param ptr pointer to the string buffer to destroy
          615  + */
          616  +void rsh_str_free(strbuf_t* ptr)
          617  +{
          618  +	if (ptr) {
          619  +		free(ptr->str);
          620  +		free(ptr);
          621  +	}
          622  +}
          623  +
          624  +/**
          625  + * Grow, if needed, internal buffer of the given string to ensure it contains
          626  + * at least new_size number bytes.
          627  + *
          628  + * @param str pointer to the string-buffer object
          629  + * @param new_size number of bytes buffer must contain
          630  + */
          631  +void rsh_str_ensure_size(strbuf_t *str, size_t new_size)
          632  +{
          633  +	if (new_size >= (size_t)str->allocated) {
          634  +		if (new_size < 64) new_size = 64;
          635  +		str->str = (char*)rsh_realloc(str->str, new_size);
          636  +		str->allocated = new_size;
          637  +	}
          638  +}
          639  +
          640  +/**
          641  + * Append a sequence of single-byte characters of the specified length to
          642  + * string buffer. The array is fully copied even if it contains the '\\0'
          643  + * character. The function ensures the string buffer still contains
          644  + * null-terminated string.
          645  + *
          646  + * @param str pointer to the string buffer
          647  + * @param text the text to append
          648  + * @param length number of character to append.
          649  + */
          650  +void rsh_str_append_n(strbuf_t *str, const char* text, size_t length)
          651  +{
          652  +	rsh_str_ensure_length(str, str->len + length + 1);
          653  +	memcpy(str->str + str->len, text, length);
          654  +	str->len += length;
          655  +	str->str[str->len] = '\0';
          656  +}
          657  +
          658  +/**
          659  + * Append a null-terminated string to the string string buffer.
          660  + *
          661  + * @param str pointer to the string buffer
          662  + * @param text the null-terminated string to append
          663  + */
          664  +void rsh_str_append(strbuf_t *str, const char* text)
          665  +{
          666  +	rsh_str_append_n(str, text, strlen(text));
          667  +}

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/common_func.h version [0b661486a0].

            1  +/* common_func.h - commonly used functions */
            2  +#ifndef COMMON_FUNC_H
            3  +#define COMMON_FUNC_H
            4  +
            5  +/* internationalization support via gettext/libintl */
            6  +#ifdef USE_GETTEXT
            7  +# include <libintl.h>
            8  +# define _(str) gettext(str)
            9  +# define TEXT_DOMAIN "rhash"
           10  +# ifndef LOCALEDIR
           11  +#  define LOCALEDIR "/usr/share/locale"
           12  +# endif /* LOCALEDIR */
           13  +#else
           14  +# define _(str) (str)
           15  +#endif /* USE_GETTEXT */
           16  +
           17  +#include <stdint.h>
           18  +#include <stdio.h>
           19  +#include <time.h> /* for time_t */
           20  +#include <stddef.h> /* for wchar_t */
           21  +
           22  +#if !defined( _WIN32) && !defined(__CYGWIN__)
           23  +# include <sys/time.h> /* for timeval */
           24  +#elif _MSC_VER > 1300
           25  +# include "platform.h"
           26  +#endif
           27  +
           28  +
           29  +#ifdef __cplusplus
           30  +extern "C" {
           31  +#endif
           32  +
           33  +/* string function */
           34  +void sprintI64(char *dst, uint64_t number, int max_width);
           35  +int  int_len(uint64_t num);
           36  +
           37  +int  urlencode(char *dst, const char *name);
           38  +int  is_binary_string(const char* str);
           39  +char* str_tolower(const char* str);
           40  +char* str_trim(char* str);
           41  +char* str_set(char* buf, int ch, int size);
           42  +char* str_append(const char* orig, const char* append);
           43  +size_t strlen_utf8_c(const char *str);
           44  +
           45  +#define IS_COMMENT(c) ((c) == ';' || (c) == '#')
           46  +
           47  +#ifdef _WIN32
           48  +typedef wchar_t rsh_tchar;
           49  +# define RSH_T(str) L##str
           50  +# define t2c(tstr) (w2c(tstr))
           51  +#else
           52  +typedef  char rsh_tchar;
           53  +# define RSH_T(str) str
           54  +# define t2c(tstr) (tstr)
           55  +#endif /* _WIN32 */
           56  +typedef rsh_tchar* tstr_t;
           57  +typedef const rsh_tchar* ctstr_t;
           58  +
           59  +#ifdef _WIN32
           60  +# define IF_WINDOWS(code) code
           61  +# define is_utf8() win_is_utf8()
           62  +# define to_utf8(str) win_to_utf8(str)
           63  +#else /* non _WIN32 part */
           64  +# define IF_WINDOWS(code)
           65  +/* stub for utf8 */
           66  +# define is_utf8() 1
           67  +# define to_utf8(str) NULL
           68  +#endif /* _WIN32 */
           69  +
           70  +/* version information */
           71  +const char* get_version_string(void);
           72  +const char* get_bt_program_name(void);
           73  +
           74  +
           75  +#ifdef _WIN32
           76  +# define rsh_fprintf win_fprintf
           77  +# define rsh_vfprintf win_vfprintf
           78  +# define rsh_fwrite win_fwrite
           79  +#else
           80  +# define rsh_fprintf fprintf
           81  +# define rsh_vfprintf vfprintf
           82  +# define rsh_fwrite fwrite
           83  +#endif
           84  +
           85  +
           86  +/* time data and functions */
           87  +
           88  +/* portable timer definition */
           89  +#if defined( _WIN32) || defined(__CYGWIN__)
           90  +typedef unsigned long long timedelta_t;
           91  +#else
           92  +#include <sys/time.h> /* for timeval */
           93  +typedef struct timeval timedelta_t;
           94  +#endif
           95  +
           96  +/**
           97  + * Start a timer.
           98  + *
           99  + * @param timer timer to start
          100  + */
          101  +void rsh_timer_start(timedelta_t* timer);
          102  +
          103  +/**
          104  + * Stop given timer.
          105  + *
          106  + * @param timer the timer to stop
          107  + * @return number of seconds timed
          108  + */
          109  +double rsh_timer_stop(timedelta_t* timer);
          110  +
          111  +/**
          112  + * Return ticks in milliseconds for time intervals measurement.
          113  + * This function should be optimized for speed and retrieve
          114  + * internal clock value, if possible.
          115  + *
          116  + * @return ticks count in milliseconds
          117  + */
          118  +unsigned rhash_get_ticks(void);
          119  +
          120  +/* program exit handlers */
          121  +typedef void (*exit_handler_t)(void);
          122  +void rsh_install_exit_handler(exit_handler_t handler);
          123  +void rsh_remove_exit_handler(void);
          124  +void rsh_exit(int code);
          125  +
          126  +/* clever malloc with error detection */
          127  +#define rsh_malloc(size) rhash_malloc(size, __FILE__, __LINE__)
          128  +#define rsh_calloc(num, size) rhash_calloc(num, size, __FILE__, __LINE__)
          129  +#define rsh_strdup(str)  rhash_strdup(str,  __FILE__, __LINE__)
          130  +#define rsh_realloc(mem, size) rhash_realloc(mem, size, __FILE__, __LINE__)
          131  +void* rhash_malloc(size_t size, const char* srcfile, int srcline);
          132  +void* rhash_calloc(size_t num, size_t size, const char* srcfile, int srcline);
          133  +char* rhash_strdup(const char* str, const char* srcfile, int srcline);
          134  +void* rhash_realloc(void* mem, size_t size, const char* srcfile, int srcline);
          135  +
          136  +#ifdef _WIN32
          137  +#define rsh_wcsdup(str) rhash_wcsdup(str, __FILE__, __LINE__)
          138  +wchar_t* rhash_wcsdup(const wchar_t* str, const char* srcfile, int srcline);
          139  +#endif
          140  +
          141  +extern void (*rsh_report_error)(const char* srcfile, int srcline, const char* format, ...);
          142  +
          143  +/* vector functions */
          144  +typedef struct vector_t
          145  +{
          146  +	void **array;
          147  +	size_t size;
          148  +	size_t allocated;
          149  +	void (*destructor)(void*);
          150  +} vector_t;
          151  +
          152  +vector_t* rsh_vector_new(void (*destructor)(void*));
          153  +vector_t* rsh_vector_new_simple(void);
          154  +void rsh_vector_free(vector_t* vect);
          155  +void rsh_vector_destroy(vector_t* vect);
          156  +void rsh_vector_add_ptr(vector_t* vect, void *item);
          157  +void rsh_vector_add_empty(vector_t* vect, size_t item_size);
          158  +#define rsh_vector_add_uint32(vect, item) { \
          159  +	rsh_vector_add_empty(vect, item_size); \
          160  +	((unsigned*)(vect)->array)[(vect)->size - 1] = item; \
          161  +}
          162  +#define rsh_vector_add_item(vect, item, item_size) { \
          163  +	rsh_vector_add_empty(vect, item_size); \
          164  +	memcpy(((char*)(vect)->array) + item_size * ((vect)->size - 1), item, item_size); \
          165  +}
          166  +
          167  +/* a vector pattern implementation, allocating elements by blocks */
          168  +typedef struct blocks_vector_t
          169  +{
          170  +	size_t size;
          171  +	vector_t blocks;
          172  +} blocks_vector_t;
          173  +
          174  +void rsh_blocks_vector_init(blocks_vector_t*);
          175  +void rsh_blocks_vector_destroy(blocks_vector_t* vect);
          176  +#define rsh_blocks_vector_get_item(bvector, index, blocksize, item_type) \
          177  +	(&((item_type*)((bvector)->blocks.array[(index) / (blocksize)]))[(index) % (blocksize)])
          178  +#define rsh_blocks_vector_get_ptr(bvector, index, blocksize, item_size) \
          179  +	(&((unsigned char*)((bvector)->blocks.array[(index) / (blocksize)]))[(item_size) * ((index) % (blocksize))])
          180  +#define rsh_blocks_vector_add(bvector, item, blocksize, item_size) { \
          181  +	if (((bvector)->size % (blocksize)) == 0) \
          182  +	rsh_vector_add_ptr(&((bvector)->blocks), rsh_malloc((item_size) * (blocksize))); \
          183  +	memcpy(rsh_blocks_vector_get_ptr((bvector), (bvector)->size, (blocksize), (item_size)), (item), (item_size)); \
          184  +	(bvector)->size++; \
          185  +}
          186  +#define rsh_blocks_vector_add_ptr(bvector, ptr, blocksize) { \
          187  +	if (((bvector)->size % (blocksize)) == 0) \
          188  +	rsh_vector_add_ptr(&((bvector)->blocks), rsh_malloc(sizeof(void*) * (blocksize))); \
          189  +	((void***)(bvector)->blocks.array)[(bvector)->size / (blocksize)][(bvector)->size % (blocksize)] = (void*)ptr; \
          190  +	(bvector)->size++; \
          191  +}
          192  +#define rsh_blocks_vector_add_empty(bvector, blocksize, item_size) { \
          193  +	if ( (((bvector)->size++) % (blocksize)) == 0) \
          194  +	rsh_vector_add_ptr(&((bvector)->blocks), rsh_malloc((item_size) * (blocksize))); \
          195  +}
          196  +
          197  +/* string buffer functions */
          198  +typedef struct strbuf_t
          199  +{
          200  +	char* str;
          201  +	size_t allocated;
          202  +	size_t len;
          203  +} strbuf_t;
          204  +
          205  +strbuf_t* rsh_str_new(void);
          206  +void rsh_str_free(strbuf_t* buf);
          207  +void rsh_str_ensure_size(strbuf_t *str, size_t new_size);
          208  +void rsh_str_append_n(strbuf_t *str, const char* text, size_t len);
          209  +void rsh_str_append(strbuf_t *str, const char* text);
          210  +
          211  +#define rsh_str_ensure_length(str, len) \
          212  +	if ((size_t)(len) >= (size_t)(str)->allocated) rsh_str_ensure_size((str), (len) + 1);
          213  +#define rsh_wstr_ensure_length(str, len) \
          214  +	if ((size_t)((len) + sizeof(wchar_t)) > (size_t)(str)->allocated) rsh_str_ensure_size((str), (len) + sizeof(wchar_t));
          215  +
          216  +#ifdef __cplusplus
          217  +} /* extern "C" */
          218  +#endif /* __cplusplus */
          219  +
          220  +#endif /* COMMON_FUNC_H */

Added milestone_releases/dependencies/rhash/v2018_03_14/v_1_3_6/Linux/rhash_1_3_6_src_tar_gz/RHash-1.3.6/configure version [9100b5da73].

            1  +#!/bin/sh
            2  +
            3  +# set default values
            4  +OPT_OPENSSL=auto
            5  +OPT_OPENSSL_RUNTIME=auto
            6  +OPT_GETTEXT=auto
            7  +
            8  +export LC_ALL=C
            9  +CFG_LINE="$*"
           10  +INSTALL_PREFIX="/usr/local"
           11  +test -z "$CC" && CC=cc
           12  +CMD_AR=ar
           13  +CMD_INSTALL=install
           14  +BUILD_DEBUG=
           15  +BUILD_STATIC=auto
           16  +BUILD_EXTRA_CFLAGS=
           17  +BUILD_EXTRA_LDFLAGS=
           18  +CHECK_LDFLAGS=
           19  +WARN_CFLAGS="-Wall -W -Wstrict-prototypes -Wnested-externs -Winline -Wpointer-arith -Wbad-function-cast -Wmissing-prototypes -Wmissing-declarations"
           20  +INSTALL_SYMLINKS="sfv-hash tiger-hash tth-hash whirlpool-hash has160-hash gost-hash edonr256-hash edonr512-hash ed2k-link magnet-link"
           21  +INSTALL_LIB_STATIC=auto
           22  +INSTALL_LIB_SHARED=auto
           23  +INSTALL_PKGCONFIGDIR="$PKG_INSTALLDIR"
           24  +
           25  +case $(echo -n) in
           26  +  -n) # SysV style
           27  +    ECHO_N=
           28  +    ECHO_C='\c'
           29  +    ;;
           30  +  *) # BSD style
           31  +    ECHO_N='-n '
           32  +    ECHO_C=
           33  +    ;;
           34  +esac
           35  +
           36  +# display error message and exit
           37  +die () {
           38  +  echo
           39  +  echo "Error: $@" >&2
           40  +  echo >&2
           41  +  test -f "$TMPLOG" && echo "Error: $@" >> "$TMPLOG"
           42  +  rm -f "$TMPBIN" "$TMPC" "$TMPT"
           43  +  echo "Check \"$TMPLOG\" if you do not understand why it failed."
           44  +  exit 1
           45  +}
           46  +
           47  +print_help()
           48  +{
           49  +  cat << EOF
           50  +Usage: configure [OPTIONS]...
           51  +
           52  +Generic Options:
           53  +  -h, --help             display this help and exit
           54  +  --cc=COMPILER          C compiler to build RHash [gcc]
           55  +  --ar=AR                librarian to build RHash [ar]
           56  +  --target=PLATFORM      target platform (i386-linux, arm-linux, etc)
           57  +  --with-install=PATH    path to a custom install program
           58  +
           59  +Directory Options:
           60  +  --prefix=DIR           prefix directory for installation [/usr/local]
           61  +  --exec-prefix=DIR      prefix directory for binaries [PREFIX]
           62  +  --bindir=DIR           directory for installing binaries [EXEC_PREFIX/bin]
           63  +  --sysconfdir=DIR       directory to look for configuration file
           64  +                         [PREFIX/etc]
           65  +  --mandir=DIR           directory for installing man pages [PREFIX/share/man]
           66  +  --libdir=DIR           directory for the rhash library [EXEC_PREFIX/lib]
           67  +  --pkgconfigdir=DIR     directory for pkg-config files [LIBDIR/pkgconfig]
           68  +  --localedir=DIR        directory for locale files [PREFIX/share/locale]
           69  +
           70  +Features options:
           71  +  --disable-FEATURE      do not include FEATURE
           72  +  --enable-gettext       enable gettext (localization) support [autodetect]
           73  +  --enable-openssl       enable OpenSSL (optimized hash functions) support
           74  +                         [autodetect]
           75  +  --enable-openssl-runtime   load OpenSSL at runtime if present [autodetect]
           76  +  --enable-static        statically link RHash binary
           77  +  --enable-lib-static    build and install LibRHash static library [auto]
           78  +  --enable-lib-shared    build and install LibRHash shared library [auto]
           79  +  --enable-symlinks[=LIST]   install symlinks to the binary [enable]
           80  +
           81  +Use these options if autodetection fails:
           82  +  --extra-cflags=FLAGS        extra CFLAGS
           83  +  --extra-ldflags=FLAGS       extra LDFLAGS
           84  +EOF
           85  +exit 0