Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The implemented ROR and ROL algorithms are actually Shift (Right | Left) #10408

Closed
ITAYC0HEN opened this issue Jun 19, 2018 · 3 comments
Closed

Comments

@ITAYC0HEN
Copy link
Contributor

Using woD ror ... or woD rol ... performs logical shifts and not circular shifts.
i.e it's not the equivalent of the ROR and ROL instructions.

The current implementation is simply a shift:

static void ror_crypt(struct ror_state *const state, const ut8 *inbuf, ut8 *outbuf, int buflen) {
	int i;
	for (i = 0; i < buflen; i++) {
		outbuf[i] = inbuf[i] >> state->key[i%state->key_size];
	}
}

While we expect something similar to this:

static void ror_crypt(struct ror_state *const state, const ut8 *inbuf, ut8 *outbuf, int buflen) {
	int i;
	for (i = 0; i < buflen; i++) {
		outbuf[i] = (inbuf[i] << key[i % state->key_size]) | (inbuf[i] >> (32 - key[i % state->key_size]));
	}
}
@radare
Copy link
Collaborator

radare commented Jun 19, 2018 via email

@ITAYC0HEN
Copy link
Contributor Author

I'm not talking about wor and wol but on woD:

[0x00000000]> woD
Usage: woD [algo] [key] [IV]
Currently supported hashes:
  md5
  ...
  ...
  ...
Available Encoders/Decoders: 
  base64
  ...
  ...
Currently supported crypto algos:
  ...
  ...
  ror    <-------
  rol    <-------
  rot
  ...
  ...

It is saying "ror" and "rol" which stands for Rotate Right|Left.
Also, the function's name is ror_crypt and not "shift_right_crypt" or something...

@radare
Copy link
Collaborator

radare commented Jun 19, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants