📄 diamond_8cpp-source.html
字号:
00190 <span class="preprocessor"></span> word32 temp1 = ((word32(a[4])<<24) | a[14]) & 0x01000080;00191 <span class="preprocessor">#endif</span>00192 <span class="preprocessor"></span> temp1 |= permtable[0][a[5]] |00193 permtable[1][a[6]] | permtable[2][a[7]] |00194 permtable[3][a[8]] | permtable[4][a[9]] |00195 permtable[5][a[10]] | permtable[6][a[11]] |00196 permtable[7][a[12]] | permtable[8][a[13]];00197 00198 <span class="preprocessor">#ifdef IS_LITTLE_ENDIAN</span>00199 <span class="preprocessor"></span> word32 temp2 = (a[8] | (word32(a[2])<<24)) & 0x80000001;00200 <span class="preprocessor">#else</span>00201 <span class="preprocessor"></span> word32 temp2 = ((word32(a[8])<<24) | a[2]) & 0x01000080;00202 <span class="preprocessor">#endif</span>00203 <span class="preprocessor"></span> temp2 |= permtable[0][a[9]] |00204 permtable[1][a[10]] | permtable[2][a[11]] |00205 permtable[3][a[12]] | permtable[4][a[13]] |00206 permtable[5][a[14]] | permtable[6][a[15]] |00207 permtable[7][a[0]] | permtable[8][a[1]];00208 00209 <span class="preprocessor">#ifdef IS_LITTLE_ENDIAN</span>00210 <span class="preprocessor"></span> word32 temp3 = (a[12] | (word32(a[6])<<24)) & 0x80000001;00211 <span class="preprocessor">#else</span>00212 <span class="preprocessor"></span> word32 temp3 = ((word32(a[12])<<24) | a[6]) & 0x01000080;00213 <span class="preprocessor">#endif</span>00214 <span class="preprocessor"></span> ((word32 *)a)[3] = temp3 | permtable[0][a[13]] |00215 permtable[1][a[14]] | permtable[2][a[15]] |00216 permtable[3][a[0]] | permtable[4][a[1]] |00217 permtable[5][a[2]] | permtable[6][a[3]] |00218 permtable[7][a[4]] | permtable[8][a[5]];00219 00220 ((word32 *)a)[0] = temp0;00221 ((word32 *)a)[1] = temp1;00222 ((word32 *)a)[2] = temp2;00223 }00224 00225 <span class="keyword">inline</span> <span class="keywordtype">void</span> Diamond2::Base::ipermute(byte *a)00226 {00227 <span class="preprocessor">#ifdef IS_LITTLE_ENDIAN</span>00228 <span class="preprocessor"></span> word32 temp0 = (a[9] | (word32(a[3])<<24)) & 0x01000080;00229 <span class="preprocessor">#else</span>00230 <span class="preprocessor"></span> word32 temp0 = ((word32(a[9])<<24) | a[3]) & 0x80000001;00231 <span class="preprocessor">#endif</span>00232 <span class="preprocessor"></span> temp0 |= ipermtable[0][a[2]] |00233 ipermtable[1][a[1]] | ipermtable[2][a[0]] |00234 ipermtable[3][a[15]] | ipermtable[4][a[14]] |00235 ipermtable[5][a[13]] | ipermtable[6][a[12]] |00236 ipermtable[7][a[11]] | ipermtable[8][a[10]];00237 00238 <span class="preprocessor">#ifdef IS_LITTLE_ENDIAN</span>00239 <span class="preprocessor"></span> word32 temp1 = (a[13] | (word32(a[7])<<24)) & 0x01000080;00240 <span class="preprocessor">#else</span>00241 <span class="preprocessor"></span> word32 temp1 = ((word32(a[13])<<24) | a[7]) & 0x80000001;00242 <span class="preprocessor">#endif</span>00243 <span class="preprocessor"></span> temp1 |= ipermtable[0][a[6]] |00244 ipermtable[1][a[5]] | ipermtable[2][a[4]] |00245 ipermtable[3][a[3]] | ipermtable[4][a[2]] |00246 ipermtable[5][a[1]] | ipermtable[6][a[0]] |00247 ipermtable[7][a[15]] | ipermtable[8][a[14]];00248 00249 <span class="preprocessor">#ifdef IS_LITTLE_ENDIAN</span>00250 <span class="preprocessor"></span> word32 temp2 = (a[1] | (word32(a[11])<<24)) & 0x01000080;00251 <span class="preprocessor">#else</span>00252 <span class="preprocessor"></span> word32 temp2 = ((word32(a[1])<<24) | a[11]) & 0x80000001;00253 <span class="preprocessor">#endif</span>00254 <span class="preprocessor"></span> temp2 |= ipermtable[0][a[10]] |00255 ipermtable[1][a[9]] | ipermtable[2][a[8]] |00256 ipermtable[3][a[7]] | ipermtable[4][a[6]] |00257 ipermtable[5][a[5]] | ipermtable[6][a[4]] |00258 ipermtable[7][a[3]] | ipermtable[8][a[2]];00259 00260 <span class="preprocessor">#ifdef IS_LITTLE_ENDIAN</span>00261 <span class="preprocessor"></span> word32 temp3 = (a[5] | (word32(a[15])<<24)) & 0x01000080;00262 <span class="preprocessor">#else</span>00263 <span class="preprocessor"></span> word32 temp3 = ((word32(a[5])<<24) | a[15]) & 0x80000001;00264 <span class="preprocessor">#endif</span>00265 <span class="preprocessor"></span> ((word32 *)a)[3] = temp3 | ipermtable[0][a[14]] |00266 ipermtable[1][a[13]] | ipermtable[2][a[12]] |00267 ipermtable[3][a[11]] | ipermtable[4][a[10]] |00268 ipermtable[5][a[9]] | ipermtable[6][a[8]] |00269 ipermtable[7][a[7]] | ipermtable[8][a[6]];00270 00271 ((word32 *)a)[0] = temp0;00272 ((word32 *)a)[1] = temp1;00273 ((word32 *)a)[2] = temp2;00274 }00275 00276 <span class="preprocessor">#else // DIAMOND_USE_PERMTABLE</span>00277 <span class="preprocessor"></span>00278 <span class="keyword">inline</span> <span class="keywordtype">void</span> Diamond2::Base::permute(byte *x)00279 {00280 byte y[16];00281 00282 y[0] = (x[0] & 1) | (x[1] & 2) | (x[2] & 4) |00283 (x[3] & 8) | (x[4] & 16) | (x[5] & 32) |00284 (x[6] & 64) | (x[7] & 128);00285 y[1] = (x[1] & 1) | (x[2] & 2) | (x[3] & 4) |00286 (x[4] & 8) | (x[5] & 16) | (x[6] & 32) |00287 (x[7] & 64) | (x[8] & 128);00288 y[2] = (x[2] & 1) | (x[3] & 2) | (x[4] & 4) |00289 (x[5] & 8) | (x[6] & 16) | (x[7] & 32) |00290 (x[8] & 64) | (x[9] & 128);00291 y[3] = (x[3] & 1) | (x[4] & 2) | (x[5] & 4) |00292 (x[6] & 8) | (x[7] & 16) | (x[8] & 32) |00293 (x[9] & 64) | (x[10] & 128);00294 y[4] = (x[4] & 1) | (x[5] & 2) | (x[6] & 4) |00295 (x[7] & 8) | (x[8] & 16) | (x[9] & 32) |00296 (x[10] & 64) | (x[11] & 128);00297 y[5] = (x[5] & 1) | (x[6] & 2) | (x[7] & 4) |00298 (x[8] & 8) | (x[9] & 16) | (x[10] & 32) |00299 (x[11] & 64) | (x[12] & 128);00300 y[6] = (x[6] & 1) | (x[7] & 2) | (x[8] & 4) |00301 (x[9] & 8) | (x[10] & 16) | (x[11] & 32) |00302 (x[12] & 64) | (x[13] & 128);00303 y[7] = (x[7] & 1) | (x[8] & 2) | (x[9] & 4) |00304 (x[10] & 8) | (x[11] & 16) | (x[12] & 32) |00305 (x[13] & 64) | (x[14] & 128);00306 y[8] = (x[8] & 1) | (x[9] & 2) | (x[10] & 4) |00307 (x[11] & 8) | (x[12] & 16) | (x[13] & 32) |00308 (x[14] & 64) | (x[15] & 128);00309 y[9] = (x[9] & 1) | (x[10] & 2) | (x[11] & 4) |00310 (x[12] & 8) | (x[13] & 16) | (x[14] & 32) |00311 (x[15] & 64) | (x[0] & 128);00312 y[10] = (x[10] & 1) | (x[11] & 2) | (x[12] & 4) |00313 (x[13] & 8) | (x[14] & 16) | (x[15] & 32) |00314 (x[0] & 64) | (x[1] & 128);00315 y[11] = (x[11] & 1) | (x[12] & 2) | (x[13] & 4) |00316 (x[14] & 8) | (x[15] & 16) | (x[0] & 32) |00317 (x[1] & 64) | (x[2] & 128);00318 y[12] = (x[12] & 1) | (x[13] & 2) | (x[14] & 4) |00319 (x[15] & 8) | (x[0] & 16) | (x[1] & 32) |00320 (x[2] & 64) | (x[3] & 128);00321 y[13] = (x[13] & 1) | (x[14] & 2) | (x[15] & 4) |00322 (x[0] & 8) | (x[1] & 16) | (x[2] & 32) |00323 (x[3] & 64) | (x[4] & 128);00324 y[14] = (x[14] & 1) | (x[15] & 2) | (x[0] & 4) |00325 (x[1] & 8) | (x[2] & 16) | (x[3] & 32) |00326 (x[4] & 64) | (x[5] & 128);00327 y[15] = (x[15] & 1) | (x[0] & 2) | (x[1] & 4) |00328 (x[2] & 8) | (x[3] & 16) | (x[4] & 32) |00329 (x[5] & 64) | (x[6] & 128);00330 00331 memcpy(x, y, 16);00332 }00333 00334 <span class="keyword">inline</span> <span class="keywordtype">void</span> Diamond2::Base::ipermute(byte *x)00335 {00336 byte y[16];00337 00338 y[0] = (x[0] & 1) | (x[15] & 2) | (x[14] & 4) |00339 (x[13] & 8) | (x[12] & 16) | (x[11] & 32) |00340 (x[10] & 64) | (x[9] & 128);00341 y[1] = (x[1] & 1) | (x[0] & 2) | (x[15] & 4) |00342 (x[14] & 8) | (x[13] & 16) | (x[12] & 32) |00343 (x[11] & 64) | (x[10] & 128);00344 y[2] = (x[2] & 1) | (x[1] & 2) | (x[0] & 4) |00345 (x[15] & 8) | (x[14] & 16) | (x[13] & 32) |00346 (x[12] & 64) | (x[11] & 128);00347 y[3] = (x[3] & 1) | (x[2] & 2) | (x[1] & 4) |00348 (x[0] & 8) | (x[15] & 16) | (x[14] & 32) |00349 (x[13] & 64) | (x[12] & 128);00350 y[4] = (x[4] & 1) | (x[3] & 2) | (x[2] & 4) |00351 (x[1] & 8) | (x[0] & 16) | (x[15] & 32) |00352 (x[14] & 64) | (x[13] & 128);00353 y[5] = (x[5] & 1) | (x[4] & 2) | (x[3] & 4) |00354 (x[2] & 8) | (x[1] & 16) | (x[0] & 32) |00355 (x[15] & 64) | (x[14] & 128);00356 y[6] = (x[6] & 1) | (x[5] & 2) | (x[4] & 4) |00357 (x[3] & 8) | (x[2] & 16) | (x[1] & 32) |00358 (x[0] & 64) | (x[15] & 128);00359 y[7] = (x[7] & 1) | (x[6] & 2) | (x[5] & 4) |00360 (x[4] & 8) | (x[3] & 16) | (x[2] & 32) |00361 (x[1] & 64) | (x[0] & 128);00362 y[8] = (x[8] & 1) | (x[7] & 2) | (x[6] & 4) |00363 (x[5] & 8) | (x[4] & 16) | (x[3] & 32) |00364 (x[2] & 64) | (x[1] & 128);00365 y[9] = (x[9] & 1) | (x[8] & 2) | (x[7] & 4) |00366 (x[6] & 8) | (x[5] & 16) | (x[4] & 32) |00367 (x[3] & 64) | (x[2] & 128);00368 y[10] = (x[10] & 1) | (x[9] & 2) | (x[8] & 4) |00369 (x[7] & 8) | (x[6] & 16) | (x[5] & 32) |00370 (x[4] & 64) | (x[3] & 128);00371 y[11] = (x[11] & 1) | (x[10] & 2) | (x[9] & 4) |00372 (x[8] & 8) | (x[7] & 16) | (x[6] & 32) |00373 (x[5] & 64) | (x[4] & 128);00374 y[12] = (x[12] & 1) | (x[11] & 2) | (x[10] & 4) |00375 (x[9] & 8) | (x[8] & 16) | (x[7] & 32) |00376 (x[6] & 64) | (x[5] & 128);00377 y[13] = (x[13] & 1) | (x[12] & 2) | (x[11] & 4) |00378 (x[10] & 8) | (x[9] & 16) | (x[8] & 32) |00379 (x[7] & 64) | (x[6] & 128);00380 y[14] = (x[14] & 1) | (x[13] & 2) | (x[12] & 4) |00381 (x[11] & 8) | (x[10] & 16) | (x[9] & 32) |00382 (x[8] & 64) | (x[7] & 128);00383 y[15] = (x[15] & 1) | (x[14] & 2) | (x[13] & 4) |00384 (x[12] & 8) | (x[11] & 16) | (x[10] & 32) |00385 (x[9] & 64) | (x[8] & 128);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -