encryption - Data type for blocks in DES-like algorithm in Java -
encryption - Data type for blocks in DES-like algorithm in Java -
i writing des-like block cipher in java. cipher works 64-bit blocks , i'm having tough time deciding how partition info useable. in case wondering info coming file , i'm going pad zeroes until nearest multiple of 64. here's i've been thinking about.
store array of longs. array of longs can traverse on each block in fewest amount of steps. but, logical operations, xor, work properly? when have split 64-bit 32-bits should convert ints or maintain using longs? , there sign worry about, think utilize long class prepare that.
store array of byte arrays. initial idea, i'm seeing limitations now. have work 8 elements per array rather 1 array of longs. might not matter don't know.
bitsets. saw these , thought reply i've been looking for, when started using them realized not suited problem @ hand , lot of methods don't thought do.
i'm wondering how more experienced this. think longs way go, i'm wondering if arithmetic work. on right track or there improve way?
you should utilize efficient primitive type cipher. if utilize 64 bit instructions, please go long
. if utilize primarity 32 bit instructions int
best type. i'll allow guess types 16 , 8 bit operations.
note should not nowadays interface straight outside world. instead should utilize interface based on byte arrays (just like, e.g. cipher
). don't want face upwards users ton of grief regards big endian, signed/unsigned etc. besides that, ciphers defined messages of specific size in bits or bytes.
certainly not utilize bitset
. it's horrible (unbounded) interface many peculiarities. absolutely not fit kind of operations.
java encryption data-structures des
Comments
Post a Comment