pad with zeros or random bytes if SecureRandom is specified in constructor.
Test X923 padding scheme.
1 X923Pad padding; 2 ubyte[] block = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]; 3 padding.addPadding(block, 15); 4 assert(block == [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,1], "X923Padding failed"); 5 assert(padding.padCount(block) == 1, "X923Padding failed"); 6 padding.addPadding(block, 7); 7 assert(block == [0,1,2,3,4,5,6,0,0,0,0,0,0,0,0,9], "X923Padding failed"); 8 assert(padding.padCount(block) == 9, "X923Padding failed"); 9 padding.addPadding(block, 0); 10 assert(block == [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16], "X923Padding failed"); 11 assert(padding.padCount(block) == 16, "X923Padding failed");
A ANSI X.923 block cipher padding implementation. This code does not support random padding anymore, because the author thinks its more susceptible to padding oracle attacks than deterministic zero padding.