equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
620 temp = (right << 1) | ((right >> 31) & 1); |
620 temp = (right << 1) | ((right >> 31) & 1); |
621 |
621 |
622 // mangler function: |
622 // mangler function: |
623 // every 6 bit is fed into the sbox, which |
623 // every 6 bit is fed into the sbox, which |
624 // produces 4-bit output |
624 // produces 4-bit output |
625 left ^= s0p[(int)((temp & 0x3f) ^ key[j+0])] |
625 left ^= s0p[(temp & 0x3f) ^ key[j+0]] |
626 ^ s1p[(int)(((temp >> 4) & 0x3f) ^ key[j+1])] |
626 ^ s1p[((temp >> 4) & 0x3f) ^ key[j+1]] |
627 ^ s2p[(int)(((temp >> 8) & 0x3f) ^ key[j+2])] |
627 ^ s2p[((temp >> 8) & 0x3f) ^ key[j+2]] |
628 ^ s3p[(int)(((temp >> 12) & 0x3f) ^ key[j+3])] |
628 ^ s3p[((temp >> 12) & 0x3f) ^ key[j+3]] |
629 ^ s4p[(int)(((temp >> 16) & 0x3f) ^ key[j+4])] |
629 ^ s4p[((temp >> 16) & 0x3f) ^ key[j+4]] |
630 ^ s5p[(int)(((temp >> 20) & 0x3f) ^ key[j+5])] |
630 ^ s5p[((temp >> 20) & 0x3f) ^ key[j+5]] |
631 ^ s6p[(int)(((temp >> 24) & 0x3f) ^ key[j+6])]; |
631 ^ s6p[((temp >> 24) & 0x3f) ^ key[j+6]]; |
632 |
632 |
633 // make the last sbox input the last bit from right[0] |
633 // make the last sbox input the last bit from right[0] |
634 temp = ((right & 1) << 5) | ((right >> 27) & 0x1f); |
634 temp = ((right & 1) << 5) | ((right >> 27) & 0x1f); |
635 left ^= s7p[(int)(temp ^ key[j+7])]; |
635 left ^= s7p[temp ^ key[j+7]]; |
636 temp = left; |
636 temp = left; |
637 left = right; |
637 left = right; |
638 right = temp; |
638 right = temp; |
639 j -= offset; |
639 j -= offset; |
640 } |
640 } |