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

Subversion Repositories threeaesc

[/] [threeaesc/] [trunk/] [aes_c_3/] [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
 
33
      result := (I(6 downto 0) & '0') xor (x"1B" and ("000" & I(7)& I(7) & "0" & I(7)& I(7)));
34
      return result;
35
    end gfmult2;
36
 
37
    function gfmult3 (
38
     I : std_logic_vector(7 downto 0))
39
    return std_logic_vector is
40
      variable result : std_logic_vector(7 downto 0);
41
    begin
42
      result := gfmult2(I) xor I;
43
      return result;
44
    end gfmult3;
45
 
46
end aes_lib;

powered by: WebSVN 2.1.0

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