Я не знаю, как работает этот код; ;
я изучаю Деса но у меня есть проблемы с этой частью;;
может ли кто-нибудь сказать мне, как работает этот код??
и зачем сдвигать биты на 4 16 2 8??
private void des( int[] inInts, int[] outInts, int[] keys ) { int fval, work, right, leftt; int round; int keysi = 0; leftt = inInts[0]; right = inInts[1]; work = ((leftt >>> 4) ^ right) & 0x0f0f0f0f; right ^= work; leftt ^= (work << 4); work = ((leftt >>> 16) ^ right) & 0x0000ffff; right ^= work; leftt ^= (work << 16); work = ((right >>> 2) ^ leftt) & 0x33333333; leftt ^= work; right ^= (work << 2); work = ((right >>> 8) ^ leftt) & 0x00ff00ff; leftt ^= work; right ^= (work << 8); right = (right << 1) | ((right >>> 31) & 1); work = (leftt ^ right) & 0xaaaaaaaa; leftt ^= work; right ^= work; leftt = (leftt << 1) | ((leftt >>> 31) & 1); for ( round = 0; round < 8; ++round ) { work = (right << 28) | (right >>> 4); work ^= keys[keysi++]; fval = SP7[ work & 0x0000003f ]; fval |= SP5[(work >>> 8) & 0x0000003f ]; fval |= SP3[(work >>> 16) & 0x0000003f ]; fval |= SP1[(work >>> 24) & 0x0000003f ]; work = right ^ keys[keysi++]; fval |= SP8[ work & 0x0000003f ]; fval |= SP6[(work >>> 8) & 0x0000003f ]; fval |= SP4[(work >>> 16) & 0x0000003f ]; fval |= SP2[(work >>> 24) & 0x0000003f ]; leftt ^= fval; work = (leftt << 28) | (leftt >>> 4); work ^= keys[keysi++]; fval = SP7[ work & 0x0000003f ]; fval |= SP5[(work >>> 8) & 0x0000003f ]; fval |= SP3[(work >>> 16) & 0x0000003f ]; fval |= SP1[(work >>> 24) & 0x0000003f ]; work = leftt ^ keys[keysi++]; fval |= SP8[ work & 0x0000003f ]; fval |= SP6[(work >>> 8) & 0x0000003f ]; fval |= SP4[(work >>> 16) & 0x0000003f ]; fval |= SP2[(work >>> 24) & 0x0000003f ]; right ^= fval; } right = (right << 31) | (right >>> 1); work = (leftt ^ right) & 0xaaaaaaaa; leftt ^= work; right ^= work; leftt = (leftt << 31) | (leftt >>> 1); work = ((leftt >>> 8) ^ right) & 0x00ff00ff; right ^= work; leftt ^= (work << 8); work = ((leftt >>> 2) ^ right) & 0x33333333; right ^= work; leftt ^= (work << 2); work = ((right >>> 16) ^ leftt) & 0x0000ffff; leftt ^= work; right ^= (work << 16); work = ((right >>> 4) ^ leftt) & 0x0f0f0f0f; leftt ^= work; right ^= (work << 4); outInts[0] = right; outInts[1] = leftt; }
Что я уже пробовал:
да, я пробую эту часть в течение 3 недель. слишком сложно с перестановкой;; кто-нибудь, помогите мне Т. Т;;