OpenCores
URL https://opencores.org/ocsvn/threeaesc/threeaesc/trunk

Subversion Repositories threeaesc

[/] [threeaesc/] [trunk/] [aes_c_1/] [src/] [aes_lib.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 entactogen
 
2
-- Two Galois multiplication functions based on http://www.isaakian.com/VHDL/AES/.
3
 
4
library ieee;
5
 
6
use IEEE.STD_LOGIC_1164.ALL;
7
use IEEE.std_logic_ARITH.ALL;
8
use IEEE.std_logic_UNSIGNED.ALL;
9
 
10
 
11
package aes_lib is
12
 
13
  function gfmult2 (
14
     I : std_logic_vector(7 downto 0))
15
    return std_logic_vector;
16
 
17
  function gfmult3 (
18
     I : std_logic_vector(7 downto 0))
19
    return std_logic_vector;
20
 
21
 
22
end aes_lib;
23
 
24
 
25
package body aes_lib is
26
 
27
    function gfmult2 (
28
     I : std_logic_vector(7 downto 0))
29
    return std_logic_vector is
30
      variable  result : std_logic_vector(7 downto 0);
31
    begin
32
      result := (I(6 downto 0) & '0') xor (x"1B" and ("000" & I(7)& I(7) & "0" & I(7)& I(7)));
33
      return result;
34
    end gfmult2;
35
 
36
    function gfmult3 (
37
     I : std_logic_vector(7 downto 0))
38
    return std_logic_vector is
39
      variable result : std_logic_vector(7 downto 0);
40
    begin
41
      result := gfmult2(I) xor I;
42
      return result;
43
    end gfmult3;
44
 
45
end aes_lib;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.