| Welcome to Crypto. We hope you enjoy your visit. You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free. Join our community! If you're already a member please log in to your account to access all of our features: |
| Red Pike cipher from other...; Red Pike Cipher | |
|---|---|
| Tweet Topic Started: Feb 27 2014, 05:56 PM (348 Views) | |
| JOE.TEKK1 | Feb 27 2014, 05:56 PM Post #1 |
|
Elite member
![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
/* Red Pike cipher source code */#include <stdint.h>typedef uint32_t word;#define CONST 0x9E3779B9#define ROUNDS 16#define ROTL(X, R) (((X) << ((R) & 31)) | ((X) >> (32 - ((R) & 31))))#define ROTR(X, R) (((X) >> ((R) & 31)) | ((X) << (32 - ((R) & 31))))void encrypt(word * x, const word * k){ unsigned int i; word rk0 = k[0]; word rk1 = k[1]; for (i = 0; i < ROUNDS; i++) { rk0 += CONST; rk1 -= CONST; x[0] ^= rk0; x[0] += x[1]; x[0] = ROTL(x[0], x[1]); x[1] = ROTR(x[1], x[0]); x[1] -= x[0]; x[1] ^= rk1; } rk0 = x[0]; x[0] = x[1]; x[1] = rk0;}void decrypt(word * x, const word * k){ word dk[2] = { k[1] - CONST * (ROUNDS + 1), k[0] + CONST * (ROUNDS + 1) }; encrypt(x, dk);} |
![]() |
|
| novice | Mar 25 2014, 11:01 PM Post #2 |
|
Super member
![]() ![]() ![]() ![]() ![]() ![]()
|
How about an example to make this a bit clearer? |
![]() |
|
| fiziwig | Mar 25 2014, 11:23 PM Post #3 |
|
Elite member
![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Here's where the code might have been cut and pasted from. It looks like the same code with newlines removed: http://en.wikipedia.org/wiki/Red_Pike_%28cipher%29 This is called the "Supposed Source Code" for Red Pike. To quote from Wikipedia:
@Joe.T: If you're going to cut and paste something without any explanation, at least have the decency to give credit to your source. Edited by fiziwig, Mar 25 2014, 11:26 PM.
|
![]() |
|
| JOE.TEKK1 | Mar 27 2014, 02:52 PM Post #4 |
|
Elite member
![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
@Joe.T: If you're going to cut and paste something without any explanation, at least have the decency to give credit to your source. Edited by fiziwig, Mar 25 2014, 07:26 PM. Red Pike Cipher ( from the the Cypher-punks Mailing List ) https://cpunks.org//pipermail/cypherpunks/2014-February/003769.html |
![]() |
|
| 1 user reading this topic (1 Guest and 0 Anonymous) | |
| « Previous Topic · General · Next Topic » |





![]](http://z2.ifrm.com/static/1/pip_r.png)



7:27 PM Jul 11