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

Subversion Repositories nfcc

[/] [nfcc/] [trunk/] [rijndael/] [cipher/] [key.vhdl] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 arif_endro
-- ------------------------------------------------------------------------
2
-- Copyright (C) 2010 Arif Endro Nugroho
3
-- All rights reserved.
4
-- 
5
-- Redistribution and use in source and binary forms, with or without
6
-- modification, are permitted provided that the following conditions
7
-- are met:
8
-- 
9
-- 1. Redistributions of source code must retain the above copyright
10
--    notice, this list of conditions and the following disclaimer.
11
-- 2. Redistributions in binary form must reproduce the above copyright
12
--    notice, this list of conditions and the following disclaimer in the
13
--    documentation and/or other materials provided with the distribution.
14
-- 
15
-- THIS SOFTWARE IS PROVIDED BY ARIF ENDRO NUGROHO "AS IS" AND ANY EXPRESS
16
-- OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17
-- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18
-- DISCLAIMED. IN NO EVENT SHALL ARIF ENDRO NUGROHO BE LIABLE FOR ANY
19
-- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20
-- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21
-- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22
-- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
23
-- STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
24
-- ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25
-- POSSIBILITY OF SUCH DAMAGE.
26
-- 
27
-- End Of License.
28
-- ------------------------------------------------------------------------
29
 
30
library ieee;
31
use ieee.std_logic_1164.all;
32
use ieee.std_logic_unsigned.all;
33
 
34
entity key is
35
  port (
36
  st : in  bit_vector ( 7 downto 0);
37
  Nk : in  bit_vector ( 3 downto 0);
38
  key: out bit_vector (31 downto 0)  -- 32 bit key output
39
  );
40
end key;
41
 
42
architecture phy of key is
43
signal keya : bit_vector (31 downto 0);
44
signal keyb : bit_vector (31 downto 0);
45
signal keyc : bit_vector (31 downto 0);
46
begin
47
 
48
  with Nk(3 downto 0) select
49
  key <=
50
  keya        when X"4",
51
  keyb        when X"6",
52
  keyc        when X"8",
53
  X"00000000" when others;
54
 
55
  with st(7 downto 0) select
56
  keya <=
57
  X"2b7e1516" when X"00", -- 0
58
  X"28aed2a6" when X"01", -- 1
59
  X"abf71588" when X"02", -- 2
60
  X"09cf4f3c" when X"03", -- 3
61
  X"a0fafe17" when X"04", -- 4
62
  X"88542cb1" when X"05", -- 5
63
  X"23a33939" when X"06", -- 6
64
  X"2a6c7605" when X"07", -- 7
65
  X"f2c295f2" when X"08", -- 8
66
  X"7a96b943" when X"09", -- 9
67
  X"5935807a" when X"0a", -- 0
68
  X"7359f67f" when X"0b", -- 1
69
  X"3d80477d" when X"0c", -- 2
70
  X"4716fe3e" when X"0d", -- 3
71
  X"1e237e44" when X"0e", -- 4
72
  X"6d7a883b" when X"0f", -- 5
73
  X"ef44a541" when X"10", -- 6
74
  X"a8525b7f" when X"11", -- 7
75
  X"b671253b" when X"12", -- 8
76
  X"db0bad00" when X"13", -- 9
77
  X"d4d1c6f8" when X"14", -- 0
78
  X"7c839d87" when X"15", -- 1
79
  X"caf2b8bc" when X"16", -- 2
80
  X"11f915bc" when X"17", -- 3
81
  X"6d88a37a" when X"18", -- 4
82
  X"110b3efd" when X"19", -- 5
83
  X"dbf98641" when X"1a", -- 6
84
  X"ca0093fd" when X"1b", -- 7
85
  X"4e54f70e" when X"1c", -- 8
86
  X"5f5fc9f3" when X"1d", -- 9
87
  X"84a64fb2" when X"1e", -- 0
88
  X"4ea6dc4f" when X"1f", -- 1
89
  X"ead27321" when X"20", -- 2
90
  X"b58dbad2" when X"21", -- 3
91
  X"312bf560" when X"22", -- 4
92
  X"7f8d292f" when X"23", -- 5
93
  X"ac7766f3" when X"24", -- 6
94
  X"19fadc21" when X"25", -- 7
95
  X"28d12941" when X"26", -- 8
96
  X"575c006e" when X"27", -- 9
97
  X"d014f9a8" when X"28", -- 0
98
  X"c9ee2589" when X"29", -- 1
99
  X"e13f0cc8" when X"2a", -- 2
100
  X"b6630ca6" when X"2b", -- 3
101
  X"00000000" when others;
102
 
103
  with st(7 downto 0) select
104
  keyb <=
105
  X"8e73b0f7" when X"00",
106
  X"da0e6452" when X"01",
107
  X"c810f32b" when X"02",
108
  X"809079e5" when X"03",
109
  X"62f8ead2" when X"04",
110
  X"522c6b7b" when X"05",
111
  X"fe0c91f7" when X"06",
112
  X"2402f5a5" when X"07",
113
  X"ec12068e" when X"08",
114
  X"6c827f6b" when X"09",
115
  X"0e7a95b9" when X"0a",
116
  X"5c56fec2" when X"0b",
117
  X"4db7b4bd" when X"0c",
118
  X"69b54118" when X"0d",
119
  X"85a74796" when X"0e",
120
  X"e92538fd" when X"0f",
121
  X"e75fad44" when X"10",
122
  X"bb095386" when X"11",
123
  X"485af057" when X"12",
124
  X"21efb14f" when X"13",
125
  X"a448f6d9" when X"14",
126
  X"4d6dce24" when X"15",
127
  X"aa326360" when X"16",
128
  X"113b30e6" when X"17",
129
  X"a25e7ed5" when X"18",
130
  X"83b1cf9a" when X"19",
131
  X"27f93943" when X"1a",
132
  X"6a94f767" when X"1b",
133
  X"c0a69407" when X"1c",
134
  X"d19da4e1" when X"1d",
135
  X"ec1786eb" when X"1e",
136
  X"6fa64971" when X"1f",
137
  X"485f7032" when X"20",
138
  X"22cb8755" when X"21",
139
  X"e26d1352" when X"22",
140
  X"33f0b7b3" when X"23",
141
  X"40beeb28" when X"24",
142
  X"2f18a259" when X"25",
143
  X"6747d26b" when X"26",
144
  X"458c553e" when X"27",
145
  X"a7e1466c" when X"28",
146
  X"9411f1df" when X"29",
147
  X"821f750a" when X"2a",
148
  X"ad07d753" when X"2b",
149
  X"ca400538" when X"2c",
150
  X"8fcc5006" when X"2d",
151
  X"282d166a" when X"2e",
152
  X"bc3ce7b5" when X"2f",
153
  X"e98ba06f" when X"30",
154
  X"448c773c" when X"31",
155
  X"8ecc7204" when X"32",
156
  X"01002202" when X"33",
157
  X"00000000" when others;
158
 
159
  with st(7 downto 0) select
160
  keyc <=
161
  X"603deb10" when X"00",
162
  X"15ca71be" when X"01",
163
  X"2b73aef0" when X"02",
164
  X"857d7781" when X"03",
165
  X"1f352c07" when X"04",
166
  X"3b6108d7" when X"05",
167
  X"2d9810a3" when X"06",
168
  X"0914dff4" when X"07",
169
  X"9ba35411" when X"08",
170
  X"8e6925af" when X"09",
171
  X"a51a8b5f" when X"0a",
172
  X"2067fcde" when X"0b",
173
  X"a8b09c1a" when X"0c",
174
  X"93d194cd" when X"0d",
175
  X"be49846e" when X"0e",
176
  X"b75d5b9a" when X"0f",
177
  X"d59aecb8" when X"10",
178
  X"5bf3c917" when X"11",
179
  X"fee94248" when X"12",
180
  X"de8ebe96" when X"13",
181
  X"b5a9328a" when X"14",
182
  X"2678a647" when X"15",
183
  X"98312229" when X"16",
184
  X"2f6c79b3" when X"17",
185
  X"812c81ad" when X"18",
186
  X"dadf48ba" when X"19",
187
  X"24360af2" when X"1a",
188
  X"fab8b464" when X"1b",
189
  X"98c5bfc9" when X"1c",
190
  X"bebd198e" when X"1d",
191
  X"268c3ba7" when X"1e",
192
  X"09e04214" when X"1f",
193
  X"68007bac" when X"20",
194
  X"b2df3316" when X"21",
195
  X"96e939e4" when X"22",
196
  X"6c518d80" when X"23",
197
  X"c814e204" when X"24",
198
  X"76a9fb8a" when X"25",
199
  X"5025c02d" when X"26",
200
  X"59c58239" when X"27",
201
  X"de136967" when X"28",
202
  X"6ccc5a71" when X"29",
203
  X"fa256395" when X"2a",
204
  X"9674ee15" when X"2b",
205
  X"5886ca5d" when X"2c",
206
  X"2e2f31d7" when X"2d",
207
  X"7e0af1fa" when X"2e",
208
  X"27cf73c3" when X"2f",
209
  X"749c47ab" when X"30",
210
  X"18501dda" when X"31",
211
  X"e2757e4f" when X"32",
212
  X"7401905a" when X"33",
213
  X"cafaaae3" when X"34",
214
  X"e4d59b34" when X"35",
215
  X"9adf6ace" when X"36",
216
  X"bd10190d" when X"37",
217
  X"fe4890d1" when X"38",
218
  X"e6188d0b" when X"39",
219
  X"046df344" when X"3a",
220
  X"706c631e" when X"3b",
221
  X"00000000" when others;
222
 
223
end phy;

powered by: WebSVN 2.1.0

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