📄 bastiger2.bas
字号:
Attribute VB_Name = "basTiger2"
' ***************************************************************************
' Module: Tiger2 Hash Algorithm
'
' ***************************************************************************
' SECURITY WARNING
'
' This code is not for export to any country prohibited by the U.S.
' Export Administration Act and regulations thereunder.
'
' This technology may not be downloaded, exported or re-exported:
' (i) into (or to a national or resident of) Afghanistan (Taliban),
' Cuba, Iran, Iraq, Libya, North Korea, Sudan, or Syria or any other
' country which the U.S. has embargoed goods (List of countries
' current as of August 2001 but is subject to change); or (ii) to
' anyone on the U.S. Treasury Department's list of Specially Designated
' Nationals or the U.S. Commerce Department's Table of Denial Orders.
'
' ***************************************************************************
' Description: Tiger is a fast New cHash function, designed to be very fast
' on modern computers, and in particular on the state-of-the-art
' 64-bit computers (like DEC-Alpha), while it is still not
' slower than other suggested hash functions on 32-bit machines.
'
' On DEC-Alpha, Tiger hashes more than 132 Mbits per second
' (measured on Alpha 7000, Model 660, on one processor). On
' the same machine, MD5 hashes only about 37Mbps (this is
' probably not the best optimized code). On 32-bit machines,
' the code of Tiger is not fully optimized. Still it hashes
' faster than MD5 on Pentiums.
'
' Tiger/192: The hash value is the full data string (48 bytes)
' of the result of the Tiger hash.
' Tiger/160: The hash value is the first 160 bits (40 bytes)
' of the Tiger hash, and is used for compatibility
' with SHA and SHA-1.
' Tiger/128: The hash value is the first 128 bits (32 bytes)
' of the result of the Tiger hash and is used for
' compatibility with MD4, MD5, RIPE-MD, the Snefru
' variants and some hash functions based on block
' ciphers.
'
' Special Note: This is a message at the top of the Tiger Hash web site.
'
' "In a response to many requests we will soon publish Tiger2,
' which will differ from Tiger only by the padding method,
' which will be the same as in MD5/SHA. Full details will
' appear soon on this page."
'
' http://www.cs.technion.ac.il/~biham/Reports/Tiger/
'
' NOTE: I elected to pad the same As cMD5. The data is stored in
' Little-Endian format with the Least Significant Bit (LSB)
' first. During the data hashing process, I make six (6)
' passes, even tho I allocated for fifteen (15), to ensure
' better security. See Transfom() routine.
'
' Reference: Tiger: A Fast New cHash function
' http://www.cs.technion.ac.il/~biham/Reports/Tiger/
' Authors: Ross Anderson, http://www.cl.cam.ac.uk/users/rja14/
' Eli Biham, http://www.cs.technion.ac.il/~biham
'
' Tiger has no usage restrictions nor patents. It can be used
' freely, with the reference implementation, with other
' implementations or with a modification to the reference
' implementation (as long as it still implements Tiger). We
' only ask you to let us know about your implementation and to
' cite the origin of Tiger and of the reference implementation.
' URL: http://www.cs.technion.ac.il/~biham/Reports/Tiger/
'
' ===========================================================================
' DATE NAME / eMAIL
' DESCRIPTION
' ----------- --------------------------------------------------------------
' 03-SEP-2003 Kenneth Ives kenaso@tx.rr.com
' 26-MAR-2006 Kenneth Ives kenaso@tx.rr.com
' Removed my experimental versions until a later date.
' 02-MAY-2006 Kenneth Ives kenaso@tx.rr.com
' Rewrote this module to use only long integers. Much faster.
' Found C source code at:
' http://www.cs.technion.ac.il/~biham/Reports/Tiger/tiger-src32.zip
' 22-DEC-2006 Kenneth Ives kenaso@tx.rr.com
' ** MD5 padding - The data is stored in Little-Endian format
' with the Least Significant Bit (LSB) first.
' ** SHA padding - The data is stored in Big-Endian format with
' the Most Significant Bit (MSB) first.
' I elected to pad the data as per MD5.
' 22-JUL-2007 Kenneth Ives kenaso@tx.rr.com
' Increased the number of passes for the hash process for better
' security. Referenced in Transform() routine.
' 12-Apr-2008 Kenneth Ives kenaso@tx.rr.com
' Modified to handle files larger than 2gb
' ***************************************************************************
Option Explicit
' ***************************************************************************
' Constants
' ***************************************************************************
Private Const MODULE_NAME As String = "basTiger2"
' ***************************************************************************
' Variables
' ***************************************************************************
Private mstrBitsInHex As String
Private mcurBitCount As Currency
Private mcurCurrBitCnt As Currency
Private malngHash(6) As Long
Private T1(0 To 1, 0 To 255) As Long
Private T2(0 To 1, 0 To 255) As Long
Private T3(0 To 1, 0 To 255) As Long
Private T4(0 To 1, 0 To 255) As Long
' ***************************************************************************
' Routine: Tiger2_File
'
' Description: Function to quickly convert a file into a hex string
'
' Syntax:
' abytData() = StrConv("C:\Test\Testfile.txt", vbFromUnicode) ' convert file location to byte array
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -