Giter Site home page Giter Site logo

fpga_sm4's Introduction

FPGA implementation of Chinese SM4 encryption algorithm.

Introduction

This project is an implementation of Chinese SM4 (also known as sms4) encryption algorithm.

Features

  • Pipeline architecture,
  • 128-bit datapath,
  • following algorithms are supported:
    • key expansion
    • Encryption
    • Decryption

Architecture

framework

Interface

interface

Interface direction width description
clk in 1-bit clock signal
resetn in 1-bit reset signal, 0 reset
sm4_enable_in in 1-bit enable sm4 core to work
encdec_sel_in in 1-bit select of encryption or decryption
enable_key_exp_in in 1-bit enable key expansion for sm4
user_key_valid_in in 1-bit valid signal of user key
user_key_in in 128-bit 128-bit user key
encdec_enable_in in 1-bit enable encryption to work
valid_in in 1-bit valid signal of plain text
data_in in 128-bit plain text, 128-bit, 16 Bytes
key_exp_ready_out out 1-bit ready signal of key expansion
ready_out out 1-bit ready signal of encryption result
result_out out 128-bit encryption result

Timing

timing

Timing diagram is edited by WaveDrom

{signal: [
  {name: 'clk', wave: 'p.....................|.'},
  {name: 'resetn', wave: '01....................|.'},
  {name: 'sm4_enable_in', wave: '0.1...................|.'},
  {name: 'encdec_sel_in', wave: '0.1...................|.'},
  {name: 'enable_key_exp_in', wave: '0..1..................|.'},
  {name: 'user_key_valid_in', wave: '0....10...............|.'},
  {name: 'user_key_in', wave: 'x....3x|..............|.',data:["Key"]},
  {name: 'key_exp_ready_out', wave: '0......|1.............|.'},
  {name: 'valid_in', wave: '0........|101010......|.'},
  {name: 'data_in', wave: 'x........|4x4x4x......|.', data:["Plain 1", "Plain 2", "Plain 3"]},
  {name: 'ready_out', wave: '0........|.....|101010|.'},
  {name: 'data_in', wave: 'x........|.....|5x5x5x|.', data:["Cpiher 1", "Cpiher 2","Cpiher 3",]},   
],
   config : { "hscale" : 2 }
}

FPGA resource utilization

utilization

FPGA Power Report

power

FPGA Timing Report

The period of clock is set to 2ns.

timing_report

fpga_sm4's People

Contributors

raymondrc avatar

Watchers

James Cloos avatar

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.