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

Subversion Repositories threeaesc

[/] [threeaesc/] [trunk/] [aes_c_2/] [src/] [aes_lib.vhd] - Rev 2

Compare with Previous | Blame | View Log

 
-- Two Galois multiplication functions based on http://www.isaakian.com/VHDL/AES/.
 
library ieee;
 
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.std_logic_ARITH.ALL;
use IEEE.std_logic_UNSIGNED.ALL;
 
 
package aes_lib is
 
  function gfmult2 (
     I : std_logic_vector(7 downto 0))
    return std_logic_vector;
 
  function gfmult3 (
     I : std_logic_vector(7 downto 0))
    return std_logic_vector;
 
 
end aes_lib;
 
 
package body aes_lib is
 
    function gfmult2 (
     I : std_logic_vector(7 downto 0))
    return std_logic_vector is
      variable  result : std_logic_vector(7 downto 0);      
    begin
 
      result := (I(6 downto 0) & '0') xor (x"1B" and ("000" & I(7)& I(7) & "0" & I(7)& I(7)));
      return result;
    end gfmult2;
 
    function gfmult3 (
     I : std_logic_vector(7 downto 0))
    return std_logic_vector is
      variable result : std_logic_vector(7 downto 0);   
    begin
      result := gfmult2(I) xor I;
      return result;
    end gfmult3;
 
end aes_lib;
 

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

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