iTextSharp.text.pdf.crypto.ARCFOUREncryption.PrepareARCFOURKey C# (CSharp) Метод

PrepareARCFOURKey() публичный Метод

public PrepareARCFOURKey ( byte key, int off, int len ) : void
key byte
off int
len int
Результат void
        public void PrepareARCFOURKey(byte[] key, int off, int len)
        {
            int index1 = 0;
            int index2 = 0;
            for (int k = 0; k < 256; ++k)
                state[k] = (byte)k;
            x = 0;
            y = 0;
            byte tmp;
            for (int k = 0; k < 256; ++k) {
                index2 = (key[index1 + off] + state[k] + index2) & 255;
                tmp = state[k];
                state[k] = state[index2];
                state[index2] = tmp;
                index1 = (index1 + 1) % len;
            }
        }

Same methods

ARCFOUREncryption::PrepareARCFOURKey ( byte key ) : void

Usage Example

Пример #1
0
 static IVGenerator(){
     rc4 = new ARCFOUREncryption();
     byte[] longBytes = new byte[8];
     long val = DateTime.Now.Ticks;
     for (int i = 0; i != 8; i++) {
         longBytes[i] = (byte)val;
         val = (long)((ulong)val >> 8);
     }
     rc4.PrepareARCFOURKey(longBytes);
 }
All Usage Examples Of iTextSharp.text.pdf.crypto.ARCFOUREncryption::PrepareARCFOURKey