NEW DATABASE - 350 MILLION DATASHEETS FROM 8500 MANUFACTURERS
SHA1-01 10K50S-1 20K60E-1 A9993E36 BA3E2571 7850C26C 9CD0D89D 2F36C116 141A8D05 - Datasheet Archive
White Paper SHA-1 Hash Function Introduction ® The Hammercores by Altera SHA-1 hash function implements the SHA-1
HammerCores by Altera White Paper SHA-1 Hash Function Introduction ® The Hammercores by Altera SHA-1 hash function implements the SHA-1 message-digest algorithm, as described in ® FIPS PUB 180-1, and is optimized for Altera FLEX 10KE and APEXTM 20K devices. The SHA-1 algorithm generates a 160-bit message-digest, or hash function, of an arbitrary length input, and is used for digital signature applications. The core supports the SHA-1 algorithm, except for the following exceptions: 32 The maximum number of bits in the input message is limited to 2 . The resolution of the input message is in bytes, not bits. A test case generator is included with the core, which converts a text file into a simulation file for the core. Ports and Parameters The SHA-1 core is fixed function, and therefore has no parameters. Table 1 shows the input signals. Table 1 Input Signals Signal Name Description SYSCLK SYSCLK is the main system clock. RESET The core is asynchronously reset when the RESET signal is asserted high. DATIN[8.1] Input bytes are written into the core using this bus, when the DSIN input is set high, and the core has asserted the RDYIN output. A total of 64 bytes is written into the core during an input cycle, except for the last block in the message, when the number of remaining bytes may be less than 64. DSIN The DSIN input strobes the DATIN[] bus into the core. LASTBYTE The LASTBYTE signal is asserted high for one clock cycle with the last byte in a message. Table 2 shows the output signals. A-WP-HCORES_SHA1-01 SHA1-01.0 Date: February 2001 1 Altera Corporation SHA-1 Hash Function Table 2 Output Signals Signal Name Description RDYIN RDYIN is asserted high by the core when it is ready to receive data. No data is read in unless DSIN is high as well. HA[32.1], HB[32.1], HC[32.1], HD[32.1],HE[32.1] This bus contains the output hash from the core. The SHA-1 specification describes the output as being the H0, H1, H2, H3, H4, words, starting with the least significant byte. The output is split into these five busses, so that the user can more readily adapt to the endian of their system. Compiling the Core The core is optimized for Altera FLEX 10KE and APEX 20K devices. It must be compiled into a device that supports dual port RAM. For best results, the core should be compiled with Global Logic Synthesis set to fast, or with a synthesis style that supports carry chains. In a 10K50S-1 10K50S-1, the core requires 1346 LEs and 6 EABs, with an fMAX of 75 MHz. In a 20K60E-1 20K60E-1, the core requires 1377 EABs, and 6 ESBs with an fMAX of 78 MHz. The system performance of the core can be calculated as follows: Performance (Mbits/s) = 160 bits × (fMAX / 335 clocks_per_hash); At 78 MHz, this translates to: Performance = 160 × (78/335) = 37 Mbits/s. Testing the Core Utilities The testing utility, HASHAA.EXE, generates test cases for both SHA-1 and MD5 hashing algorithm cores, as well as being a reference for the SHA-1 hashing algorithm. Example Test Standard Sequence The HASHAA utility can perform a hash on a standard set of test sequences, or a file. Running one of the standard set of tests: HASHAA 1 This selects the calculation of the hash of "abc", which is "A9993E36 A9993E36 4706816A BA3E2571 BA3E2571 7850C26C 7850C26C 9CD0D89D 9CD0D89D". Running the utility also creates the test case for this sequence. From the simulator window, in Inputs/Outputs option (File menu), select the vector file SHAA.VEC, and start the simulation. 2 Altera Corporation SHA-1 Hash Function The result of simulating the testcase is: HA = "A9993E36 A9993E36" HB = "4706816A" HC = "BA3E2571 BA3E2571" HD = "7850C26C 7850C26C" HD = "9CD0D89D 9CD0D89D" Upon inspection, this is the same as the reference utility output. Example Test File Create a file, TEST.TXT, containing (in capitals): HELLO WORLD Running a test on this file: HASHAA TEST.TXT Creates a hash of "2f36c116 141a8d05 827f9abe a0f617fe 25287505". Running the HASHAA.EXE utility, pointing to TEST.TXT, creates the test case for this. HASHAA TEST.TXT From the simulator window, in Inputs/Outputs option (File menu), select the vector file HASHAA.VEC, and start the simulation. The result of simulating the testcase is: HA = "2F36C116 2F36C116" HB = "141A8D05 141A8D05" HC = "827F9ABE 827F9ABE" HD = "A0F617FE A0F617FE" HE = "25287505" Upon inspection, this is the same as the reference utility output. 3 Altera Corporation SHA-1 Hash Function Appendix A - Top Level Wrapper An unencrypted top level wrapper, TOP_LEVEL_SHAA.TDF is provided, to make it easier to instantiate the core. The source code of the wrapper is as follows: FUNCTION shaa (sysclk, reset, datin[8.1], dsin, lastbyte) RETURNS (rdyin, ha[32.1], hb[32.1], hc[32.1], hd[32.1], he[32.1]); subdesign top_level_shaa ( sysclk, reset : INPUT; datin[8.1] : INPUT; dsin, lastbyte : INPUT; rdyin : OUTPUT; ha[32.1], hb[32.1], hc[32.1], hd[32.1], he[32.1] : OUTPUT; ) BEGIN (rdyin, ha[32.1], hb[32.1], hc[32.1], hd[32.1], he[32.1]) = shaa (sysclk, reset, datin[8.1], dsin, lastbyte); END; 101 Innovation Drive San Jose, CA 95134 (408) 544-7000 http://www.altera.com Copyright 2001 Altera Corporation. Altera, FLEX, MegaWizard, and AMPP are trademarks and/or service marks of Altera Corporation in the United States and other countries. Other brands or products are trademarks of their respective holders. The specifications contained herein are subject to change without notice. Altera assumes no responsibility or liability arising out of the application or use of any information, product, or service described herein except as expressly agreed to in writing by Altera Corporation. Altera customers are advised to obtain the latest version of device specifications before relying on any published information and before placing orders for products or services. All rights reserved. 4