⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bastiger3.bas

📁 a Tiger Hash algorithmn code
💻 BAS
字号:
Attribute VB_Name = "basTiger3"
' ***************************************************************************
' Module:       Tiger3 Hash Algorithm
'
' This module is my experimental version for Tiger 224, 256, 384, 512-bit
' output.  I call it Tiger3.  I have not had any problems with it thus far.
' If you should encounter any problems, please email me at:
'
'           Kenneth Ives  kenaso@tx.rr.com
'
' DO NOT CONTACT   Ross Anderson, http://www.cl.cam.ac.uk/users/rja14/
'                  Eli Biham, http://www.cs.technion.ac.il/~biham
' because they did not write this module nor are they responsible in any
' manner as to its content.
'
' ***************************************************************************
'                      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.
'
'                Tiger3/224:  The hash value is the first 224 bits (56 bytes)
'                             of the result of the hash.
'                Tiger3/256:  The hash value is the first 256 bits (64 bytes)
'                             of the result of the hash.
'                Tiger3/384:  The hash value is the first 384 bits (96 bytes)
'                             of the result of the hash.
'                Tiger3/512:  The hash value is the first 512 bits (128 bytes)
'                             of the result of the hash.
'
' 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 Tiger3,
'                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."
'
' NOTE:          I elected to pad the same As MD5. 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/
'                http://www.cs.technion.ac.il/~biham/Reports/Tiger/tiger-src32.zip
'
'                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.
'
' ===========================================================================
'    DATE      NAME / eMAIL
'              DESCRIPTION
' -----------  --------------------------------------------------------------
' 15-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
' 07-MAY-2008  Kenneth Ives  kenaso@tx.rr.com
'              Modified the output to 224, 256, 384, 512 bits.  Rewrote
'              calculation routines that accessed the work array 'malngHash()'
' ***************************************************************************
Option Explicit

' ***************************************************************************
' Module Constants
' ***************************************************************************
  Private Const MODULE_NAME As String = "basTiger3"
  Private Const MAXLONG     As Long = 2147483647  ' max size of long integer
  
' ***************************************************************************
' Variables
' ***************************************************************************
  Private mstrBitsInHex        As String
  Private mcurBitCount         As Currency
  Private mcurCurrBitCnt       As Currency
  Private malngHash()          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:       Tiger3_File
'
' Description:   Function to digest a file and output the result as a string
'                of hexadecimal characters.
'
' Syntax:
'   abytData() = StrConv("C:\Test\Testfile.txt", vbFromUnicode)  ' convert file location to byte array

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -