Git Product home page Git Product logo

secure_hash's Introduction

SHA-1,SHA-256,SHA-512 Secure Hash Generator VHDL RTL.

概要

SHA-1,SHA-256,SHA-512を計算する論理合成可能なVHDLモジュールです.

論理合成可能です。

1クロックで1、2ワード(1ワードはSHA-1およびSHA-256で32bit、SHA-512では64bit)処理できます.

開発環境

以下の開発環境で合成出来ることを確認しています.

  • Xilinx ISE14.2
  • Xilinx Vivado 2017.2
  • Altera QuartusII 11.1sp2 Web Edition(32bit)

論理合成

fpga/xilinx/ise14.2 の下に Xilinx 社FPGA(Spartan6,Virtex6)用の各プロジェクトがあります.
fpga/xilinx/vivado2017.2 の下に Xilinx 社FPGA(Spartan7,Artix7)用の各プロジェクトがあります.
fpga/altera/11.2sp2 の下に Altera 社FPGA用の各プロジェクトを生成するスクリプトがあります.

論理合成の結果

SHA-1 WORD=32bit BLOCK=512bit
Device Speed WORDS BLOCK_GAP Cycle/Block Slice[Regs,LUTs] Fmax Throughput
Spartan6 -3 1 0 80 1151,1590 145[MHz] 928[Mbit/sec]
1 81 1157,1730 141[MHz] 890[Mbit/sec]
2 0 40 1525,1873 87[MHz] 1113[Mbit/sec]
1 41 1527,1914 91[MHz] 1135[Mbit/sec]
Spartan7 -3 1 0 80 1134,2527 170[MHz] 1085[Mbit/sec]
1 81 1131,2567 208[MHz] 1317[Mbit/sec]
2 0 40 1469,2421 122[MHz] 1561[Mbit/sec]
1 41 1470,2434 150[MHz] 1875[Mbit/sec]
Virtex6 -3 1 0 80 1138,1609 204[MHz] 1306[Mbit/sec]
1 81 1139,1680 227[MHz] 1436[Mbit/sec]
2 0 40 1515,1851 133[MHz] 1707[Mbit/sec]
1 41 1517,1897 136[MHz] 1711[Mbit/sec]
Artix7 -2 1 0 80 1134,2527 169[MHz] 1085[Mbit/sec]
1 81 1131,2566 200[MHz] 1264[Mbit/sec]
2 0 40 1469,2421 122[MHz] 1561[Mbit/sec]
1 41 1470,2435 147[MHz] 1836[Mbit/sec]
CycloneIV Auto 1 0 80 1018,1938 111[MHz] 711[Mbit/sec]
1 81 1019,1944 123[MHz] 771[Mbit/sec]
2 0 40 1190,2469 77[MHz] 961[Mbit/sec]
1 41 1191,2476 92[MHz] 1135[Mbit/sec]
Arria II Auto 1 0 80 1022,1224 123[MHz] 790[Mbit/sec]
1 81 1023,1231 152[MHz] 960[Mbit/sec]
2 0 40 1191,1605 104[MHz] 1338[Mbit/sec]
1 41 1191,1608 104[MHz] 1307[Mbit/sec]
SHA-256 WORD=32bit BLOCK=512bit
Device Speed WORDS BLOCK_GAP Cycle/Block Slice[Regs,LUTs] Fmax Throughput
Spartan6 -3 1 0 64 1460,2587 102[MHz] 816[Mbit/sec]
1 65 1442,2597 128[MHz] 1010[Mbit/sec]
4 68 1555,2971 178[MHz] 1344[Mbit/sec]
2 0 32 1862,3096 59[MHz] 941[Mbit/sec]
1 33 1835,3094 69[MHz] 1070[Mbit/sec]
Spartan7 -2 1 0 64 1361,3408 143[MHz] 1143[Mbit/sec]
1 65 1371,3407 169[MHz] 1335[Mbit/sec]
4 68 1498,3739 217[MHz] 1637[Mbit/sec]
2 0 32 1699,3542 85[MHz] 1368[Mbit/sec]
1 33 1701,3585 100[MHz] 1552[Mbit/sec]
Artix7 -2 1 0 64 1361,3408 143[MHz] 1143[Mbit/sec]
1 65 1371,3405 167[MHz] 1313[Mbit/sec]
4 68 1498,3736 208[MHz] 1569[Mbit/sec]
2 0 32 1699,3542 85[MHz] 1356[Mbit/sec]
1 33 1701,3590 100[MHz] 1552[Mbit/sec]
Virtex6 -3 1 0 64 1452,2546 163[MHz] 1311[Mbit/sec]
1 65 1425,2583 200[MHz] 1575[Mbit/sec]
4 68 1530,2766 250[MHz] 1882[Mbit/sec]
2 0 32 1858,3094 95[MHz] 1524[Mbit/sec]
1 33 1831,3078 114[MHz] 1763[Mbit/sec]
CycloneIV Auto 1 0 64 1334,3177 104[MHz] 832[Mbit/sec]
1 65 1336,3196 119[MHz] 937[Mbit/sec]
4 68 1441,3360 127[MHz] 953[Mbit/sec]
2 0 32 1504,3877 65[MHz] 1046[Mbit/sec]
1 33 1506,3897 69[MHz] 1070[Mbit/sec]
Arria II Auto 1 0 64 1338,1979 118[MHz] 945[Mbit/sec]
1 65 1340,2001 121[MHz] 953[Mbit/sec]
4 68 1445,2050 158[MHz] 1197[Mbit/sec]
2 0 32 1507,2569 88[MHz] 1416[Mbit/sec]
1 33 1509,2574 92[MHz] 1473[Mbit/sec]
SHA-512 WORD=64bit BLOCK=1024bit
Device Speed WORDS BLOCK_GAP Cycle/Block Slice[Regs,LUTs] Fmax Throughput
Spartan6 -3 1 0 80 2880,8091 83[MHz] 1067[Mbit/sec]
1 81 2842,8133 109[MHz] 1374[Mbit/sec]
4 84 3024,8755 125[MHz] 1524[Mbit/sec]
2 0 40 3705,10270 45[MHz] 1163[Mbit/sec]
1 41 3648,10361 59[MHz] 1469[Mbit/sec]
Spartan7 -2 1 0 80 2662,10812 69[MHz] 889[Mbit/sec]
1 81 2663,10800 68[MHz] 854[Mbit/sec]
4 84 2871,10849 67[MHz] 813[Mbit/sec]
2 0 40 3377,13832 68[MHz] 1730[Mbit/sec]
1 41 3372,13837 68[MHz] 1688[Mbit/sec]
Artix7 -2 1 0 80 2662,10819 70[MHz] 895[Mbit/sec]
1 81 2663,10801 67[MHz] 843[Mbit/sec]
4 84 2871,10853 69[MHz] 841[Mbit/sec]
2 0 40 3377,13824 67[MHz] 1707[Mbit/sec]
1 41 3372,13822 69[MHz] 1734[Mbit/sec]
Virtex6 -3 1 0 80 2876,8012 147[MHz] 1882[Mbit/sec]
1 81 2818,8207 164[MHz] 2072[Mbit/sec]
4 84 3023,8538 200[MHz] 2438[Mbit/sec]
2 0 40 3701,10387 87[MHz] 2226[Mbit/sec]
1 41 3641,10429 95[MHz] 2379[Mbit/sec]
CycloneIV Auto 1 0 80 2627,6950 81[MHz] 1049[Mbit/sec]
1 81 2628,6963 102[MHz] 1290[Mbit/sec]
4 84 2829,7326 114[MHz] 1385[Mbit/sec]
2 0 40 2961,8778 53[MHz] 1354[Mbit/sec]
1 41 2962,8795 51[MHz] 1287[Mbit/sec]
Arria II Auto 1 0 80 2631,4504 103[MHz] 1320[Mbit/sec]
1 81 2632,4597 114[MHz] 1444[Mbit/sec]
4 84 2833,4629 137[MHz] 1680[Mbit/sec]
2 0 40 2964,5729 73[MHz] 1879[Mbit/sec]
1 41 2965,5762 78[MHz] 1948[Mbit/sec]

シミュレーション

他に必要なファイル

シミュレーションをするためには次のファイルが必要です。

GHDLによるシミュレーション

シミュレーションには GHDL (http://ghdl.free.fr/) を使いました.

ディレクトリ sim/ghdl に移動して make コマンドでシミュレーションが走ります.

もしかしたら他のシミュレーションでは走らないかもしれません。その際はご一報ください.

Isimによるシミュレーション

Xilinx社のIsimでシミュレーションすることができます.

ISE Design Suite 14.2 で動作を確認しています.

ディレクトリ sim/isim にXilinx社のプロジェクトファイルがあります.

注意

とりあえず簡単なテストはしていますが、完璧ではありません.

ライセンス

二条項BSDライセンス (2-clause BSD license) で公開しています。

secure_hash's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

secure_hash's Issues

Simplify SHA256

maybe :

function Maj(B,C,D:WORD_TYPE) return std_logic_vector is
begin
return (B and C) or (B and D) or (C and D);
end function;

can become:

return (x and y) or (z and (x or y))

which is one less logical operator over a 32 bit product

and

function Ch(B,C,D:WORD_TYPE) return std_logic_vector is
begin
return (B and C) or ((not B) and D);

can be:

z xor (x and (y xor z))

These simplifications are clearly documented in

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.