|
Ravel H. Joyce wrote: hanks for that, by the way. I was rushed off to dinner before.
No problem.
Ravel H. Joyce wrote: It must be annoying, answering stupid questions.
No, not at all - no questions are stupid (well...no intelligent questions... )
Ravel H. Joyce wrote: You'd be an awesome teacher, I reckon.
I'm afraid I didn't enjoy my teaching days. Most of the students weren't interested in learning and I had no patience for it. If a student was interested in the material, I had all the patience in the world. Unfortunately most were not - they were there either because they thought that university was the "popular thing to do" or they wanted what they thought was a fast ticket to a high-paying job. They were unwilling to make the required effort and I didn't appreciate that. The internet is a much better teaching platform - I can "disconnect" from it at will! But I did like teaching the higher university years - that's where the serious students were... Anyways, I much prefer a situation where I teach from time-to-time and where I can do my research most of the time...I like writing books, not teaching books.
Anyways, ask all the questions you like - don't be discouraged by my pessimism.
And when the sunlight hits the olive oil, don't hesitate.
|
|
|
|
|
Um, OK:
What happens when the unstoppable force hits the immovable object?
Drawing on my fine command of language, I said nothing.
|
|
|
|
|
To answer that, you have to know if the chicken or the egg came first!
And when the sunlight hits the olive oil, don't hesitate.
|
|
|
|
|
I'd use my time machine to go and see, but...you know those ships in bottles? Yeah, my time machine is stuck in a Klein bottle of all things, and then some guy and his weird cat went and took it! I knew how fast they were running away, but I couldn't for the life of me figure out where they were.
Drawing on my fine command of language, I said nothing.
|
|
|
|
|
Ravel H. Joyce wrote: I'd use my time machine to go and see, but...you know those ships in bottles? Yeah, my time machine is stuck in a Klein bottle of all things, and then some guy and his weird cat went and took it! I knew how fast they were running away, but I couldn't for the life of me figure out where they were.
Klein bottles? Schrödinger's cat? Where do you pick this stuff up at your age?
And when the sunlight hits the olive oil, don't hesitate.
|
|
|
|
|
I think a lot of it was from StumbleUpon[^]
Drawing on my fine command of language, I said nothing.
|
|
|
|
|
73Zeppelin wrote: If a student was interested in the material, I had all the patience in the world.
I know that feeling. Been there.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
phap wrote: about hamilton algorithm
Huh? Did you mean Hamiltonian Cycle problem?
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
java implemenation of the RC5 is too faster. Someone measured RC5 java.imp before?
Here, process time of the RC5 encryption and decryption are almost expressed as 5 or 4 digits of the number in nanosecond. So someone tried it before? or saw any book, references on this job? I need the references for the RC5 java imp.
Look it process time here:
DES: enc - 804172 n.s dec - 442647 n.s
RC5: enc - 13904 n.s dec - 3783 n.s
modified on Monday, April 7, 2008 5:31 AM
|
|
|
|
|
I'm not sure what you are asking, but if you look at the details of RC5 and DES it is not surprising that RC5 is way faster. The problem with DES is that it has a strange wordlength and has many bit operations. It was designed to be easy to implement in hardware because at that time software implementations of anything at the speeds required were not feasible. RC5 looks as if the operations align much better with the instruction set of a modern computer.
Peter
"Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."
|
|
|
|
|
Acctually, I'm doing comparison between 5 algorithms in the java imp. The comparison value at the RC5 is too shorter than others (DES, 3DES, Skipjack and Mine "new" ). If you know about RC5 and DES code below , please take a look on the source codes of them. Comeplete resource.
RC5test.java
----------------------------RC5test.java---------------------------------
// RC5 demo worker thread.
import java.math.BigInteger;
import java.security.SecureRandom;
import java.util.*;
class RC5test {
public static void main(String[] args)
{
RC5test aaa = new RC5test();
aaa.runa();
}
public void runa()
{
SecureRandom random = new SecureRandom();
// cyphertext and iv data from the RSA test pseudo-contest "RSA-32/12/8-test"
BigInteger pt1 = new BigInteger(32, random);
long txt;
RC5 rc5 = new RC5_32_12_8();
byte[] key = new byte[rc5.keySize()];
// uncommenting these lines gives the correct key, we'll just start searching close to it
key[0] = (byte)0x82;
key[1] = (byte)0xe5;
key[2] = (byte)0x1b;
key[3] = (byte)0x9f;
key[4] = (byte)0x9c;
key[5] = (byte)0xc7;
key[6] = (byte)0x18;
key[7] = (byte)0xf9;
long stime, fdetime, detime, entime, fentime;
stime = fdetime = detime = entime = fentime = 0;
Random r = new Random();
long pt = (long)r.nextInt();
long cipher = 0;
int i =0;
for(i = 0; i<1000; i++){
stime = System.nanoTime();
rc5.setup(key);
cipher = rc5.encrypt(pt);
entime = System.nanoTime() - stime;
System.out.println("Encryption Cipher: " +String.valueOf(cipher));
stime = System.nanoTime();
txt = rc5.decrypt(cipher);// ^ iv;
detime = System.nanoTime() - stime;
System.out.println("Decryption Cipher: " +String.valueOf(txt));
System.out.println("");
fdetime += detime;
//System.out.println("Decryption: " +String.valueOf(detime));
fentime += entime;
//System.out.println("Encryption: " +String.valueOf(entime));
}
System.out.println("encrypt time: " + fentime/1000 + "ns");
System.out.println("decrypt time: " + fdetime/1000 + "ns");
System.out.println("run for: " + i + " times");
//Host.updateStats(keys, end - start, true);
}
}
----------------------------------------end of the RC5test---------------------------------------
RC5_32_12_8.java
---------------------------------------RC5_32_12_8.java------------------------------------------
// RC5-32/12/8 implementation. Unrolls all important loops.
class RC5_32_12_8 implements RC5 {
private static final int w = 32; /* word size in bits */
private static final int r = 12; /* number of rounds */
private static final int b = 8; /* number of bytes in key */
private static final int c = 2; /* number words in key = ceil(8*b/w)*/
private static final int t = 26; /* size of table S = 2*(r+1) words */
// static int[] initS = new int[t];
static int initS0, initS1, initS2, initS3, initS4, initS5, initS6, initS7, initS8, initS9;
static int initS10, initS11, initS12, initS13, initS14, initS15, initS16, initS17, initS18, initS19;
static int initS20, initS21, initS22, initS23, initS24, initS25;
// int[] S = new int[t]; /* expanded key table */
int S0, S1, S2, S3, S4, S5, S6, S7, S8, S9;
int S10, S11, S12, S13, S14, S15, S16, S17, S18, S19;
int S20, S21, S22, S23, S24, S25;
private static final int P = 0xb7e15163, Q = 0x9e3779b9; /* magic constants */
static {
initS0 = P;
// for (int i = 1; i < t; i++) {
// initS[i] = initS[i-1] + Q;
// }
initS1 = initS0 + Q;
initS2 = initS1 + Q;
initS3 = initS2 + Q;
initS4 = initS3 + Q;
initS5 = initS4 + Q;
initS6 = initS5 + Q;
initS7 = initS6 + Q;
initS8 = initS7 + Q;
initS9 = initS8 + Q;
initS10 = initS9 + Q;
initS11 = initS10 + Q;
initS12 = initS11 + Q;
initS13 = initS12 + Q;
initS14 = initS13 + Q;
initS15 = initS14 + Q;
initS16 = initS15 + Q;
initS17 = initS16 + Q;
initS18 = initS17 + Q;
initS19 = initS18 + Q;
initS20 = initS19 + Q;
initS21 = initS20 + Q;
initS22 = initS21 + Q;
initS23 = initS22 + Q;
initS24 = initS23 + Q;
initS25 = initS24 + Q;
}
public int keySize()
{
return b;
}
// int ROTL(int x, int y)
// {
// return (x << (y & (w-1))) | (x >>> (w - (y & (w-1))));
// }
//
// int ROTR(int x, int y)
// {
// return (x >>> (y & (w-1))) | (x << (w - (y & (w-1))));
// }
public long encrypt(long pt)
{
int A = (int)(pt & 0xffffffffL) + S0;
int B = (int)(pt >>> 32) + S1;
// for (int i = 1; i <= r; i++) {
// int x = A ^ B;
// int y = B & (w-1);
// A = /*ROTL(A ^ B, B)*/ ((x << y) | (x >>> (w-y))) + S[2*i];
// x = B ^ A;
// y = A & (w-1);
// B = /*ROTL(B ^ A, A)*/ ((x << y) | (x >>> (w-y))) + S[2*i+1];
// }
int x, y;
x = A ^ B; y = B & (w-1); A = ((x << y) | (x >>> (w-y))) + S2 ; x = B ^ A; y = A & (w-1); B = ((x << y) | (x >>> (w-y))) + S3 ;
x = A ^ B; y = B & (w-1); A = ((x << y) | (x >>> (w-y))) + S4 ; x = B ^ A; y = A & (w-1); B = ((x << y) | (x >>> (w-y))) + S5 ;
x = A ^ B; y = B & (w-1); A = ((x << y) | (x >>> (w-y))) + S6 ; x = B ^ A; y = A & (w-1); B = ((x << y) | (x >>> (w-y))) + S7 ;
x = A ^ B; y = B & (w-1); A = ((x << y) | (x >>> (w-y))) + S8 ; x = B ^ A; y = A & (w-1); B = ((x << y) | (x >>> (w-y))) + S9 ;
x = A ^ B; y = B & (w-1); A = ((x << y) | (x >>> (w-y))) + S10; x = B ^ A; y = A & (w-1); B = ((x << y) | (x >>> (w-y))) + S11;
x = A ^ B; y = B & (w-1); A = ((x << y) | (x >>> (w-y))) + S12; x = B ^ A; y = A & (w-1); B = ((x << y) | (x >>> (w-y))) + S13;
x = A ^ B; y = B & (w-1); A = ((x << y) | (x >>> (w-y))) + S14; x = B ^ A; y = A & (w-1); B = ((x << y) | (x >>> (w-y))) + S15;
x = A ^ B; y = B & (w-1); A = ((x << y) | (x >>> (w-y))) + S16; x = B ^ A; y = A & (w-1); B = ((x << y) | (x >>> (w-y))) + S17;
x = A ^ B; y = B & (w-1); A = ((x << y) | (x >>> (w-y))) + S18; x = B ^ A; y = A & (w-1); B = ((x << y) | (x >>> (w-y))) + S19;
x = A ^ B; y = B & (w-1); A = ((x << y) | (x >>> (w-y))) + S20; x = B ^ A; y = A & (w-1); B = ((x << y) | (x >>> (w-y))) + S21;
x = A ^ B; y = B & (w-1); A = ((x << y) | (x >>> (w-y))) + S22; x = B ^ A; y = A & (w-1); B = ((x << y) | (x >>> (w-y))) + S23;
x = A ^ B; y = B & (w-1); A = ((x << y) | (x >>> (w-y))) + S24; x = B ^ A; y = A & (w-1); B = ((x << y) | (x >>> (w-y))) + S25;
return ((long)B << 32) + (A & 0xffffffffL);
}
public long decrypt(long ct)
{
int A = (int)(ct & 0xffffffffL);
int B = (int)(ct >>> 32);
// for (int i = r; i > 0; i--) {
// int x = B - S[2*i+1];
// int y = A & (w-1);
// B = /*ROTR(B - S[2*i+1], A)*/ ((x >>> y) | (x << (w-y))) ^ A;
// x = A - S[2*i];
// y = B & (w-1);
// A = /*ROTR(A - S[2*i], B)*/ ((x >>> y) | (x << (w-y))) ^ B;
// }
int x, y;
x = B - S25; y = A & (w-1); B = ((x >>> y) | (x << (w-y))) ^ A; x = A - S24; y = B & (w-1); A = ((x >>> y) | (x << (w-y))) ^ B;
x = B - S23; y = A & (w-1); B = ((x >>> y) | (x << (w-y))) ^ A; x = A - S22; y = B & (w-1); A = ((x >>> y) | (x << (w-y))) ^ B;
x = B - S21; y = A & (w-1); B = ((x >>> y) | (x << (w-y))) ^ A; x = A - S20; y = B & (w-1); A = ((x >>> y) | (x << (w-y))) ^ B;
x = B - S19; y = A & (w-1); B = ((x >>> y) | (x << (w-y))) ^ A; x = A - S18; y = B & (w-1); A = ((x >>> y) | (x << (w-y))) ^ B;
x = B - S17; y = A & (w-1); B = ((x >>> y) | (x << (w-y))) ^ A; x = A - S16; y = B & (w-1); A = ((x >>> y) | (x << (w-y))) ^ B;
x = B - S15; y = A & (w-1); B = ((x >>> y) | (x << (w-y))) ^ A; x = A - S14; y = B & (w-1); A = ((x >>> y) | (x << (w-y))) ^ B;
x = B - S13; y = A & (w-1); B = ((x >>> y) | (x << (w-y))) ^ A; x = A - S12; y = B & (w-1); A = ((x >>> y) | (x << (w-y))) ^ B;
x = B - S11; y = A & (w-1); B = ((x >>> y) | (x << (w-y))) ^ A; x = A - S10; y = B & (w-1); A = ((x >>> y) | (x << (w-y))) ^ B;
x = B - S9 ; y = A & (w-1); B = ((x >>> y) | (x << (w-y))) ^ A; x = A - S8 ; y = B & (w-1); A = ((x >>> y) | (x << (w-y))) ^ B;
x = B - S7 ; y = A & (w-1); B = ((x >>> y) | (x << (w-y))) ^ A; x = A - S6 ; y = B & (w-1); A = ((x >>> y) | (x << (w-y))) ^ B;
x = B - S5 ; y = A & (w-1); B = ((x >>> y) | (x << (w-y))) ^ A; x = A - S4 ; y = B & (w-1); A = ((x >>> y) | (x << (w-y))) ^ B;
x = B - S3 ; y = A & (w-1); B = ((x >>> y) | (x << (w-y))) ^ A; x = A - S2 ; y = B & (w-1); A = ((x >>> y) | (x << (w-y))) ^ B;
return ((long)(B - S1) << 32) + ((A - S0) & 0xffffffffL);
}
public void setup(byte[] K)
{
int i, j, k, u=w/8, A, B;
/* Initialize L, then S, then mix key into S */
// for (i=b-1,L[c-1]=0; i!=-1; i--) L[i/u] = (L[i/u]<<8)+(K[i]&0xff);
int L0 = ((K[3] & 0xff) << 24) | ((K[2] & 0xff) << 16) | ((K[1] & 0xff) << 8) | (K[0] & 0xff);
int L1 = ((K[7] & 0xff) << 24) | ((K[6] & 0xff) << 16) | ((K[5] & 0xff) << 8) | (K[4] & 0xff);
// for (A=B=i=j=k=0; k<3*t; k++) { /* 3*t > 3*c */
// int x = S[i] + (A+B);
// A = S[i] = /*ROTL(S[i]+(A+B),3);*/ (x << 3) | (x >>> 29);
// x = L[j] + (A+B);
// int y = (A+B) & (w-1);
// B = L[j] = /*ROTL(L[j]+(A+B),(A+B));*/ (x << y) | (x >>> (w-y));
// /*i = (i+1) % t;*/ i++; if (i >= t) i = 0;
// /*j = (j+1) % c;*/ j++; if (j >= c) j = 0;
// }
A = B = 0;
int x, y;
x = initS0 + (A+B); A = S0 = (x << 3) | (x >>> 29); x = L0 + (A+B); y = (A+B) & (w-1); B = L0 = (x << y) | (x >>> (w-y));
x = initS1 + (A+B); A = S1 = (x << 3) | (x >>> 29); x = L1 + (A+B); y = (A+B) & (w-1); B = L1 = (x << y) | (x >>> (w-y));
x = initS2 + (A+B); A = S2 = (x << 3) | (x >>> 29); x = L0 + (A+B); y = (A+B) & (w-1); B = L0 = (x << y) | (x >>> (w-y));
x = initS3 + (A+B); A = S3 = (x << 3) | (x >>> 29); x = L1 + (A+B); y = (A+B) & (w-1); B = L1 = (x << y) | (x >>> (w-y));
x = initS4 + (A+B); A = S4 = (x << 3) | (x >>> 29); x = L0 + (A+B); y = (A+B) & (w-1); B = L0 = (x << y) | (x >>> (w-y));
x = initS5 + (A+B); A = S5 = (x << 3) | (x >>> 29); x = L1 + (A+B); y = (A+B) & (w-1); B = L1 = (x << y) | (x >>> (w-y));
x = initS6 + (A+B); A = S6 = (x << 3) | (x >>> 29); x = L0 + (A+B); y = (A+B) & (w-1); B = L0 = (x << y) | (x >>> (w-y));
x = initS7 + (A+B); A = S7 = (x << 3) | (x >>> 29); x = L1 + (A+B); y = (A+B) & (w-1); B = L1 = (x << y) | (x >>> (w-y));
x = initS8 + (A+B); A = S8 = (x << 3) | (x >>> 29); x = L0 + (A+B); y = (A+B) & (w-1); B = L0 = (x << y) | (x >>> (w-y));
x = initS9 + (A+B); A = S9 = (x << 3) | (x >>> 29); x = L1 + (A+B); y = (A+B) & (w-1); B = L1 = (x << y) | (x >>> (w-y));
x = initS10 + (A+B); A = S10 = (x << 3) | (x >>> 29); x = L0 + (A+B); y = (A+B) & (w-1); B = L0 = (x << y) | (x >>> (w-y));
x = initS11 + (A+B); A = S11 = (x << 3) | (x >>> 29); x = L1 + (A+B); y = (A+B) & (w-1); B = L1 = (x << y) | (x >>> (w-y));
x = initS12 + (A+B); A = S12 = (x << 3) | (x >>> 29); x = L0 + (A+B); y = (A+B) & (w-1); B = L0 = (x << y) | (x >>> (w-y));
x = initS13 + (A+B); A = S13 = (x << 3) | (x >>> 29); x = L1 + (A+B); y = (A+B) & (w-1); B = L1 = (x << y) | (x >>> (w-y));
x = initS14 + (A+B); A = S14 = (x << 3) | (x >>> 29); x = L0 + (A+B); y = (A+B) & (w-1); B = L0 = (x << y) | (x >>> (w-y));
x = initS15 + (A+B); A = S15 = (x << 3) | (x >>> 29); x = L1 + (A+B); y = (A+B) & (w-1); B = L1 = (x << y) | (x >>> (w-y));
x = initS16 + (A+B); A = S16 = (x << 3) | (x >>> 29); x = L0 + (A+B); y = (A+B) & (w-1); B = L0 = (x << y) | (x >>> (w-y));
x = initS17 + (A+B); A = S17 = (x << 3) | (x >>> 29); x = L1 + (A+B); y = (A+B) & (w-1); B = L1 = (x << y) | (x >>> (w-y));
x = initS18 + (A+B); A = S18 = (x << 3) | (x >>> 29); x = L0 + (A+B); y = (A+B) & (w-1); B = L0 = (x << y) | (x >>> (w-y));
x = initS19 + (A+B); A = S19 = (x << 3) | (x >>> 29); x = L1 + (A+B); y = (A+B) & (w-1); B = L1 = (x << y) | (x >>> (w-y));
x = initS20 + (A+B); A = S20 = (x << 3) | (x >>> 29); x = L0 + (A+B); y = (A+B) & (w-1); B = L0 = (x << y) | (x >>> (w-y));
x = initS21 + (A+B); A = S21 = (x << 3) | (x >>> 29); x = L1 + (A+B); y = (A+B) & (w-1); B = L1 = (x << y) | (x >>> (w-y));
x = initS22 + (A+B); A = S22 = (x << 3) | (x >>> 29); x = L0 + (A+B); y = (A+B) & (w-1); B = L0 = (x << y) | (x >>> (w-y));
x = initS23 + (A+B); A = S23 = (x << 3) | (x >>> 29); x = L1 + (A+B); y = (A+B) & (w-1); B = L1 = (x << y) | (x >>> (w-y));
x = initS24 + (A+B); A = S24 = (x << 3) | (x >>> 29); x = L0 + (A+B); y = (A+B) & (w-1); B = L0 = (x << y) | (x >>> (w-y));
x = initS25 + (A+B); A = S25 = (x << 3) | (x >>> 29); x = L1 + (A+B); y = (A+B) & (w-1); B = L1 = (x << y) | (x >>> (w-y));
x = S0 + (A+B); A = S0 = (x << 3) | (x >>> 29); x = L0 + (A+B); y = (A+B) & (w-1); B = L0 = (x << y) | (x >>> (w-y));
x = S1 + (A+B); A = S1 = (x << 3) | (x >>> 29); x = L1 + (A+B); y = (A+B) & (w-1); B = L1 = (x << y) | (x >>> (w-y));
x = S2 + (A+B); A = S2 = (x << 3) | (x >>> 29); x = L0 + (A+B); y = (A+B) & (w-1); B = L0 = (x << y) | (x >>> (w-y));
x = S3 + (A+B); A = S3 = (x << 3) | (x >>> 29); x = L1 + (A+B); y = (A+B) & (w-1); B = L1 = (x << y) | (x >>> (w-y));
x = S4 + (A+B); A = S4 = (x << 3) | (x >>> 29); x = L0 + (A+B); y = (A+B) & (w-1); B = L0 = (x << y) | (x >>> (w-y));
x = S5 + (A+B); A = S5 = (x << 3) | (x >>> 29); x = L1 + (A+B); y = (A+B) & (w-1); B = L1 = (x << y) | (x >>> (w-y));
x = S6 + (A+B); A = S6 = (x << 3) | (x >>> 29); x = L0 + (A+B); y = (A+B) & (w-1); B = L0 = (x << y) | (x >>> (w-y));
x = S7 + (A+B); A = S7 = (x << 3) | (x >>> 29); x = L1 + (A+B); y = (A+B) & (w-1); B = L1 = (x << y) | (x >>> (w-y));
x = S8 + (A+B); A = S8 = (x << 3) | (x >>> 29); x = L0 + (A+B); y = (A+B) & (w-1); B = L0 = (x << y) | (x >>> (w-y));
x = S9 + (A+B); A = S9 = (x << 3) | (x >>> 29); x = L1 + (A+B); y = (A+B) & (w-1); B = L1 = (x << y) | (x >>> (w-y));
x = S10 + (A+B); A = S10 = (x << 3) | (x >>> 29); x = L0 + (A+B); y = (A+B) & (w-1); B = L0 = (x << y) | (x >>> (w-y));
x = S11 + (A+B); A = S11 = (x << 3) | (x >>> 29); x = L1 + (A+B); y = (A+B) & (w-1); B = L1 = (x << y) | (x >>> (w-y));
x = S12 + (A+B); A = S12 = (x << 3) | (x >>> 29); x = L0 + (A+B); y = (A+B) & (w-1); B = L0 = (x << y) | (x >>> (w-y));
x = S13 + (A+B); A = S13 = (x << 3) | (x >>> 29); x = L1 + (A+B); y = (A+B) & (w-1); B = L1 = (x << y) | (x >>> (w-y));
x = S14 + (A+B); A = S14 = (x << 3) | (x >>> 29); x = L0 + (A+B); y = (A+B) & (w-1); B = L0 = (x << y) | (x >>> (w-y));
x = S15 + (A+B); A = S15 = (x << 3) | (x >>> 29); x = L1 + (A+B); y = (A+B) & (w-1); B = L1 = (x << y) | (x >>> (w-y));
x = S16 + (A+B); A = S16 = (x << 3) | (x >>> 29); x = L0 + (A+B); y = (A+B) & (w-1); B = L0 = (x << y) | (x >>> (w-y));
x = S17 + (A+B); A = S17 = (x << 3) | (x >>> 29); x = L1 + (A+B); y = (A+B) & (w-1); B = L1 = (x << y) | (x >>> (w-y));
x = S18 + (A+B); A = S18 = (x << 3) | (x >>> 29); x = L0 + (A+B); y = (A+B) & (w-1); B = L0 = (x << y) | (x >>> (w-y));
x = S19 + (A+B); A = S19 = (x << 3) | (x >>> 29); x = L1 + (A+B); y = (A+B) & (w-1); B = L1 = (x << y) | (x >>> (w-y));
x = S20 + (A+B); A = S20 = (x << 3) | (x >>> 29); x = L0 + (A+B); y = (A+B) & (w-1); B = L0 = (x << y) | (x >>> (w-y));
x = S21 + (A+B); A = S21 = (x << 3) | (x >>> 29); x = L1 + (A+B); y = (A+B) & (w-1); B = L1 = (x << y) | (x >>> (w-y));
x = S22 + (A+B); A = S22 = (x << 3) | (x >>> 29); x = L0 + (A+B); y = (A+B) & (w-1); B = L0 = (x << y) | (x >>> (w-y));
x = S23 + (A+B); A = S23 = (x << 3) | (x >>> 29); x = L1 + (A+B); y = (A+B) & (w-1); B = L1 = (x << y) | (x >>> (w-y));
x = S24 + (A+B); A = S24 = (x << 3) | (x >>> 29); x = L0 + (A+B); y = (A+B) & (w-1); B = L0 = (x << y) | (x >>> (w-y));
x = S25 + (A+B); A = S25 = (x << 3) | (x >>> 29); x = L1 + (A+B); y = (A+B) & (w-1); B = L1 = (x << y) | (x >>> (w-y));
x = S0 + (A+B); A = S0 = (x << 3) | (x >>> 29); x = L0 + (A+B); y = (A+B) & (w-1); B = L0 = (x << y) | (x >>> (w-y));
x = S1 + (A+B); A = S1 = (x << 3) | (x >>> 29); x = L1 + (A+B); y = (A+B) & (w-1); B = L1 = (x << y) | (x >>> (w-y));
x = S2 + (A+B); A = S2 = (x << 3) | (x >>> 29); x = L0 + (A+B); y = (A+B) & (w-1); B = L0 = (x << y) | (x >>> (w-y));
x = S3 + (A+B); A = S3 = (x << 3) | (x >>> 29); x = L1 + (A+B); y = (A+B) & (w-1); B = L1 = (x << y) | (x >>> (w-y));
x = S4 + (A+B); A = S4 = (x << 3) | (x >>> 29); x = L0 + (A+B); y = (A+B) & (w-1); B = L0 = (x << y) | (x >>> (w-y));
x = S5 + (A+B); A = S5 = (x << 3) | (x >>> 29); x = L1 + (A+B); y = (A+B) & (w-1); B = L1 = (x << y) | (x >>> (w-y));
x = S6 + (A+B); A = S6 = (x << 3) | (x >>> 29); x = L0 + (A+B); y = (A+B) & (w-1); B = L0 = (x << y) | (x >>> (w-y));
x = S7 + (A+B); A = S7 = (x << 3) | (x >>> 29); x = L1 + (A+B); y = (A+B) & (w-1); B = L1 = (x << y) | (x >>> (w-y));
x = S8 + (A+B); A = S8 = (x << 3) | (x >>> 29); x = L0 + (A+B); y = (A+B) & (w-1); B = L0 = (x << y) | (x >>> (w-y));
x = S9 + (A+B); A = S9 = (x << 3) | (x >>> 29); x = L1 + (A+B); y = (A+B) & (w-1); B = L1 = (x << y) | (x >>> (w-y));
x = S10 + (A+B); A = S10 = (x << 3) | (x >>> 29); x = L0 + (A+B); y = (A+B) & (w-1); B = L0 = (x << y) | (x >>> (w-y));
x = S11 + (A+B); A = S11 = (x << 3) | (x >>> 29); x = L1 + (A+B); y = (A+B) & (w-1); B = L1 = (x << y) | (x >>> (w-y));
x = S12 + (A+B); A = S12 = (x << 3) | (x >>> 29); x = L0 + (A+B); y = (A+B) & (w-1); B = L0 = (x << y) | (x >>> (w-y));
x = S13 + (A+B); A = S13 = (x << 3) | (x >>> 29); x = L1 + (A+B); y = (A+B) & (w-1); B = L1 = (x << y) | (x >>> (w-y));
x = S14 + (A+B); A = S14 = (x << 3) | (x >>> 29); x = L0 + (A+B); y = (A+B) & (w-1); B = L0 = (x << y) | (x >>> (w-y));
x = S15 + (A+B); A = S15 = (x << 3) | (x >>> 29); x = L1 + (A+B); y = (A+B) & (w-1); B = L1 = (x << y) | (x >>> (w-y));
x = S16 + (A+B); A = S16 = (x << 3) | (x >>> 29); x = L0 + (A+B); y = (A+B) & (w-1); B = L0 = (x << y) | (x >>> (w-y));
x = S17 + (A+B); A = S17 = (x << 3) | (x >>> 29); x = L1 + (A+B); y = (A+B) & (w-1); B = L1 = (x << y) | (x >>> (w-y));
x = S18 + (A+B); A = S18 = (x << 3) | (x >>> 29); x = L0 + (A+B); y = (A+B) & (w-1); B = L0 = (x << y) | (x >>> (w-y));
x = S19 + (A+B); A = S19 = (x << 3) | (x >>> 29); x = L1 + (A+B); y = (A+B) & (w-1); B = L1 = (x << y) | (x >>> (w-y));
x = S20 + (A+B); A = S20 = (x << 3) | (x >>> 29); x = L0 + (A+B); y = (A+B) & (w-1); B = L0 = (x << y) | (x >>> (w-y));
x = S21 + (A+B); A = S21 = (x << 3) | (x >>> 29); x = L1 + (A+B); y = (A+B) & (w-1); B = L1 = (x << y) | (x >>> (w-y));
x = S22 + (A+B); A = S22 = (x << 3) | (x >>> 29); x = L0 + (A+B); y = (A+B) & (w-1); B = L0 = (x << y) | (x >>> (w-y));
x = S23 + (A+B); A = S23 = (x << 3) | (x >>> 29); x = L1 + (A+B); y = (A+B) & (w-1); B = L1 = (x << y) | (x >>> (w-y));
x = S24 + (A+B); A = S24 = (x << 3) | (x >>> 29); x = L0 + (A+B); y = (A+B) & (w-1); B = L0 = (x << y) | (x >>> (w-y));
x = S25 + (A+B); A = S25 = (x << 3) | (x >>> 29); x = L1 + (A+B); y = (A+B) & (w-1); B = L1 = (x << y) | (x >>> (w-y));
}
}
------------------------------------------end of the RC5_32_12_8.java-------------------------------
RC5.java
-------------------------------------------RC5.java------------------------------------------------
// Generic RC5 interface to support different implementations.
// Assumes 32 bit RC5 word size.
interface RC5 {
public int keySize();
public long encrypt(long pt);
public long decrypt(long ct);
public void setup(byte[] K);
}
-----------------------------------------------end of the RC5.java----------------------------------
DES.java
--------------------------------------------DES.java------------------------------------------------
import java.security.*;
import javax.crypto.*;
import javax.crypto.spec.*;
import java.math.*;
import java.security.SecureRandom;/** * * @author ~Tan~ */public class DES{
public static void main(String args[]) { long proc, proc2, fproc;
long dec, dec2, fdec; fproc = fdec =0; try {
SecureRandom random = new SecureRandom();
BigInteger message = new BigInteger(32, random);
byte[] encrypted = message.toString().getBytes();
byte[] raw, decrypted;
SecretKeySpec keySpec;
int i;
for(i=0; i<1000; i++){
// Generate a DES key
proc2 = System.nanoTime();
KeyGenerator keyGen = KeyGenerator.getInstance("DES");
SecretKey key = keyGen.generateKey();
//encryption
raw = key.getEncoded();
keySpec = new SecretKeySpec(raw, "DES");
Cipher cipher = Cipher.getInstance("DES");
cipher.init(Cipher.ENCRYPT_MODE, keySpec);
encrypted = cipher.doFinal(encrypted);
proc = System.nanoTime() - proc2;
//decryption dec2 = System.nanoTime();
cipher.init(Cipher.DECRYPT_MODE, keySpec);
decrypted = cipher.doFinal(encrypted);
dec = System.nanoTime() - dec2;
fproc+=proc;
fdec+=dec;
}
fproc/=1000;
fdec/=1000;
//System.out.println("input msg is: " + message.toString());
System.out.println("input msg is: " + message.bitLength() + " bit");
//System.out.println("DES key generation takes: " + des + "ns");
System.out.println("DES key encryption takes: " + fproc + "ns");
//System.out.println("encrypted become: " + encrypted.toString());
System.out.println("DES key decryption takes: " + fdec + "ns");
//System.out.println("decrypted become: " + new String(decrypted));
} catch (Exception e) {
}
} }
--------------------------------------end of the DES.java ------------------------------------------
|
|
|
|
|
Look I'm not sure what you are trying to do, and I'm not interested in working through the swathe of code you pasted.
If you step back a bit, you appear to be asking for information on RC5 implementation because
Bimbaa wrote: The comparison value at the RC5 is too shorter than others (DES, 3DES, Skipjack and Mine "new" ).
Look at the algorithms and try to understand which would take more instruction cycles. I think it will be clear why DES (and 3DES) is very slow in software compared to something like RC5.
Also time is not everything, there are other issues like cryptographic security that should be addressed in comparing ciphers.
Peter
"Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."
|
|
|
|
|
Well. It seems like you've never been tried process time for any impl in java before. You may have theory and a bit pro.skill. If you tried and had idea, you would be said another instruction. Process may show different time at practice from the time at theory and time at talking. Yes, it can't be lost the cryptographic security issue that is explained by algorithm strength metric.
|
|
|
|
|
|
Hi,
Could someone please give me a 'yah' or 'nah' to the following please:
"The only situation where you will have more than one answer for a complex number is when you root the answer - i.e (a + ib)^1/2 means two answers, (a + ib)^1/3 means three answers"
Cheers,
|
|
|
|
|
MarkBrock wrote: 'yah' or 'nah'
maybe, it depend on what the question is.
If you are asking about solutions to algebraic equations (polynomials like x^2=-1 but also more complex like 3x^4+2x^3+x+2) then the general rule is that an nth order equation has n roots. They may be real (x^2=1 has 2 roots +1 and -1).
There are lots of other equations e.g. log(x)=-1 and which can have an infinite number of solutions if there are no limits on x. You don't need complex numbers for this, the number of solutions to sin(x)=0 is also infinite.
So for a general function f(x), if you are solving for f(x)=a, then the graph of some functions pass the value of a for multiple values of x.
Peter
"Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."
|
|
|
|
|
I think we can safely say 'nah' then?
Cheers mate.
|
|
|
|
|
yah
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
nah.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
We're waiting for his revolutionary Data Hiding Algorithm [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Didn't you get it? All the details were hidden in his messages! Go back and take another look - make sure you read the entire thread - and check ALL the spaces.
Peter
"Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."
|
|
|
|
|
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
CPallini wrote: We're waiting for his revolutionary Data Hiding Algorithm
Although I too seriously doubt this, I am not one for deliberately calling out someone in a new thread. Certainly if they step on the pillory I'll flog a bit also, that's human nature. But I generally don't try to drag them back to the pillory for more ridicule.
I hope, that he has pulled up some of the hex editors, and other editors and realized that the idea is simple: it is too simple. Hiding data from the least qualified threat (the person who only knows how to use notepad), is not a very effective algorithm. Perhaps he has thrown out the algorithm and is trying for another. Who knows? Though he has given me some ideas, I may have to try it when I get the time. But mine would definitely change the text. Don't worry, no magic or infinite compression here, my wiccan skills are lacking, and outside of sitting on the data, I have only traditional ways of squashing bits down.
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
|
|
|
|
|
Well, Probably you're right. My sarcasm is bad . Anyway, you know, he promised me a sample text, done in a week. I'm not going to blame him if he'll not able to produce the sample. I'm just curious about.
BTW I've to admit I'm even more curous about your ideas, 'cause I cannot figure out a method for hiding info in a plain text file, but probably I'm lacking of imagination. Of course, I know, if someone will find a good trick then it probably will remain a secret.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
CPallini wrote: BTW I've to admit I'm even more curous about your ideas, 'cause I cannot figure out a method for hiding info in a plain text file, but probably I'm lacking of imagination. Of course, I know, if someone will find a good trick then it probably will remain a secret.
In my case I wasn't trying to "keep the same content" or "hide text" per se.... but I started wondering about text and public and private key systems and anagrams.... odd combination there. But what if you tried to take a sentance, and given the letters to hide and a given text, you created a new text which was a constrained anagram such that you could decode it later. It is still text, though now may not make much sense. But if you had the original text, which was the majority, could you then extract the remainder and retrieve the word anagram. Say one word per sentance, or one letter ever xx letters, or something like that. The net result is more like constrained anagram poetry/writing than encryption, but would certainly be a bugger to solve without knowing what was added or what the original text was.
See, I wasn't trying to keep the original text, I know that is too difficult, but keeping the original properties, i.e. an anagram of the original text and keep it as text. You could even do a letter substitution based on some formula, and then anagram. Knowing the original text you should be able to find out what letter was added Talk about a large key!
for instance.... hiding "code project" within the text "four score and seven years ago our fathers brought forth a new"
would be
"A Decrescendo Nervous Of A Seafarer Yoghourt Pros Cab Fetter Wrought John"
Interleaved encryption. It is text, but a complete jibberish unless you knew what one of the halves was. You could even constrain it such that you chose an anagram that collapsed one space and added one letter. Though I think the latter would be too constrained and give itself away. The hard thing about interleaving text is fooling yourself into thinking that it is good because you WANT it to be good (self-bias).
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
modified on Monday, March 31, 2008 5:04 PM
|
|
|
|
|