Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > sci.crypt > #50057 > unrolled thread
| Started by | Richard Heathfield <rjh@cpax.org.uk> |
|---|---|
| First post | 2021-09-20 10:17 +0100 |
| Last post | 2021-09-25 16:11 +0200 |
| Articles | 10 on this page of 30 — 6 participants |
Back to article view | Back to sci.crypt
CHATX - a thread starter that's not as easy as it looks. Richard Heathfield <rjh@cpax.org.uk> - 2021-09-20 10:17 +0100
Re: CHATX - a thread starter that's not as easy as it looks. MM <mrvmurray@gmail.com> - 2021-09-20 07:00 -0700
Re: CHATX - a thread starter that's not as easy as it looks. Richard Heathfield <rjh@cpax.org.uk> - 2021-09-20 15:17 +0100
Re: CHATX - a thread starter that's not as easy as it looks. MM <mrvmurray@gmail.com> - 2021-09-20 10:52 -0700
Re: CHATX - a thread starter that's not as easy as it looks. Richard Heathfield <rjh@cpax.org.uk> - 2021-09-20 19:10 +0100
Re: CHATX - a thread starter that's not as easy as it looks. Max <maxturv26@gmx.net> - 2021-09-20 20:36 +0200
Re: CHATX - a thread starter that's not as easy as it looks. Richard Heathfield <rjh@cpax.org.uk> - 2021-09-20 19:42 +0100
Re: CHATX - a thread starter that's not as easy as it looks. Max <maxturv26@gmx.net> - 2021-09-20 20:50 +0200
Re: CHATX - a thread starter that's not as easy as it looks. Richard Heathfield <rjh@cpax.org.uk> - 2021-09-20 21:02 +0100
Re: CHATX - a thread starter that's not as easy as it looks. Max <maxturv26@gmx.net> - 2021-09-20 22:24 +0200
Re: CHATX - a thread starter that's not as easy as it looks. Richard Heathfield <rjh@cpax.org.uk> - 2021-09-20 22:08 +0100
Re: CHATX - a thread starter that's not as easy as it looks. wizzofozz <oxxxxxxxxxxxs@gmail.com> - 2021-09-20 21:43 +0200
Re: CHATX - a thread starter that's not as easy as it looks. Max <maxturv26@gmx.net> - 2021-09-20 21:50 +0200
Re: CHATX - a thread starter that's not as easy as it looks. Phil Carmody <pc+usenet@asdf.org> - 2021-09-21 17:00 +0300
Re: CHATX - a thread starter that's not as easy as it looks. Richard Heathfield <rjh@cpax.org.uk> - 2021-09-21 15:22 +0100
Re: CHATX - a thread starter that's not as easy as it looks. Max <maxturv26@gmx.net> - 2021-09-21 23:31 +0200
Re: CHATX - a thread starter that's not as easy as it looks. Richard Heathfield <rjh@cpax.org.uk> - 2021-09-21 23:03 +0100
Re: CHATX - a thread starter that's not as easy as it looks. Max <maxturv26@gmx.net> - 2021-09-22 00:22 +0200
Re: CHATX - a thread starter that's not as easy as it looks. wizzofozz <oxxxxxxxxxxxs@gmail.com> - 2021-09-25 13:29 +0200
Re: CHATX - a thread starter that's not as easy as it looks. Phil Carmody <pc+usenet@asdf.org> - 2021-09-26 14:39 +0300
Re: CHATX - a thread starter that's not as easy as it looks. Richard Harnden <richard.nospam@gmail.com> - 2021-09-21 15:07 +0100
Re: CHATX - a thread starter that's not as easy as it looks. Richard Heathfield <rjh@cpax.org.uk> - 2021-09-21 15:18 +0100
Re: CHATX - a thread starter that's not as easy as it looks. Phil Carmody <pc+usenet@asdf.org> - 2021-09-21 21:43 +0300
Re: CHATX - a thread starter that's not as easy as it looks. Richard Heathfield <rjh@cpax.org.uk> - 2021-09-21 20:41 +0100
Re: CHATX - a thread starter that's not as easy as it looks. wizzofozz <oxxxxxxxxxxxs@gmail.com> - 2021-09-25 02:24 +0200
Re: CHATX - a thread starter that's not as easy as it looks. Richard Heathfield <rjh@cpax.org.uk> - 2021-09-25 05:24 +0100
Re: CHATX - a thread starter that's not as easy as it looks. Richard Harnden <richard.nospam@gmail.com> - 2021-09-25 13:56 +0100
Re: CHATX - a thread starter that's not as easy as it looks. Richard Heathfield <rjh@cpax.org.uk> - 2021-09-25 14:21 +0100
Re: CHATX - a thread starter that's not as easy as it looks. Richard Heathfield <rjh@cpax.org.uk> - 2021-09-25 14:28 +0100
Re: CHATX - a thread starter that's not as easy as it looks. wizzofozz <oxxxxxxxxxxxs@gmail.com> - 2021-09-25 16:11 +0200
Page 2 of 2 — ← Prev page 1 [2]
| From | Richard Harnden <richard.nospam@gmail.com> |
|---|---|
| Date | 2021-09-21 15:07 +0100 |
| Message-ID | <sicoug$653$1@dont-email.me> |
| In reply to | #50057 |
On 20/09/2021 10:17, Richard Heathfield wrote: > lFcrdtwo,econ you itelt nx > ook ohns af you sdinliofy > ttie aegtrxtxmxuxex xoxexcxyt > hhs tlxo?ixhx xsxdxtx xnxrxpx > tFar eat apcrexim,tc t semr poexx > hot cxnra prodita eua doceyctdion > a-t sa.dxrxtxax xtxlxoxsx xsxIxcn > t-ehtrxex xhxnxix xoxkx,xax x xax > eAed danptns yenetxig > vnr hop'e sah ro.hxnx > pTseiplo lomtil hht ii fsr'nxex ohs brebte eslttae dtfienetcxxx abdtxesnaxdsdabdcduae wa dend,elck xhxsx:xxxx ne w-e d-e deea ss pednieg aihextxexex xxxx xpxix xfxlxnxsxtx xextxexsxmx xexgxh xaxrxox xixex xoxbx xhx xaxexlxnxtx.
[toc] | [prev] | [next] | [standalone]
| From | Richard Heathfield <rjh@cpax.org.uk> |
|---|---|
| Date | 2021-09-21 15:18 +0100 |
| Message-ID | <sicpk5$b7q$1@dont-email.me> |
| In reply to | #50072 |
On 21/09/2021 15:07, Richard Harnden wrote: > On 20/09/2021 10:17, Richard Heathfield wrote: >> lFcrdtwo,econ you itelt nx >> ook ohns af you sdinliofy >> ttie aegtrxtxmxuxex xoxexcxyt >> hhs tlxo?ixhx xsxdxtx xnxrxpx >> tFar eat apcrexim,tc t semr poexx >> hot cxnra prodita eua doceyctdion >> a-t sa.dxrxtxax xtxlxoxsx xsxIxcn >> t-ehtrxex xhxnxix xoxkx,xax x xax >> eAed danptns yenetxig >> vnr hop'e sah ro.hxnx >> > > pTseiplo lomtil hht ii fsr'nxex > ohs brebte eslttae dtfienetcxxx > abdtxesnaxdsdabdcduae wa dend,elck xhxsx:xxxx > ne w-e d-e deea ss pednieg aihextxexex xxxx > xpxix xfxlxnxsxtx xextxexsxmx xexgxh > xaxrxox xixex xoxbx xhx xaxexlxnxtx. > That's certainly one of the problems, yes. Another is that I rushed the whole cryptosystem through from conception through software implementation to publication for competitive peer review in about twelve minutes all told. So I cannot guarantee that other problems may not also become apparent. (I can reveal, for example, that my decryption code does a workmanlike but less than stellar job and isn't about to win any prizes.) I can report one important theoretical discovery about the system: it turns out *not* to be informational-theoretically secure. Who'd ha' thunk it, eh? -- Richard Heathfield Email: rjh at cpax dot org dot uk "Usenet is a strange place" - dmr 29 July 1999 Sig line 4 vacant - apply within
[toc] | [prev] | [next] | [standalone]
| From | Phil Carmody <pc+usenet@asdf.org> |
|---|---|
| Date | 2021-09-21 21:43 +0300 |
| Message-ID | <878rzpepmm.fsf@zotaspaz.fatphil.org> |
| In reply to | #50074 |
Richard Heathfield <rjh@cpax.org.uk> writes: > I can report one important theoretical discovery about the system: it > turns out *not* to be informational-theoretically secure. Who'd ha' > thunk it, eh? It's also remarkably readable, once you know what you're doing. Phil -- We are no longer hunters and nomads. No longer awed and frightened, as we have gained some understanding of the world in which we live. As such, we can cast aside childish remnants from the dawn of our civilization. -- NotSanguine on SoylentNews, after Eugen Weber in /The Western Tradition/
[toc] | [prev] | [next] | [standalone]
| From | Richard Heathfield <rjh@cpax.org.uk> |
|---|---|
| Date | 2021-09-21 20:41 +0100 |
| Message-ID | <sidcgk$rgl$1@dont-email.me> |
| In reply to | #50076 |
On 21/09/2021 19:43, Phil Carmody wrote: > Richard Heathfield <rjh@cpax.org.uk> writes: >> I can report one important theoretical discovery about the system: it >> turns out *not* to be informational-theoretically secure. Who'd ha' >> thunk it, eh? > > It's also remarkably readable, once you know what you're doing. Yes, I was surprised by that too; it was then that I suggested to MM that it might be crackable by eye. A pencil and paper cipher, really, of the "secure vs your kid sister" variety. (I am of course referring to Schneier's opening to Applied Cryptography.) -- Richard Heathfield Email: rjh at cpax dot org dot uk "Usenet is a strange place" - dmr 29 July 1999 Sig line 4 vacant - apply within
[toc] | [prev] | [next] | [standalone]
| From | wizzofozz <oxxxxxxxxxxxs@gmail.com> |
|---|---|
| Date | 2021-09-25 02:24 +0200 |
| Message-ID | <silq8i$v5o$1@dont-email.me> |
| In reply to | #50057 |
Op 20-9-2021 om 11:17 schreef Richard Heathfield: > lFcrdtwo,econ you itelt nx > ook ohns af you sdinliofy > ttie aegtrxtxmxuxex xoxexcxyt > hhs tlxo?ixhx xsxdxtx xnxrxpx > tFar eat apcrexim,tc t semr poexx > hot cxnra prodita eua doceyctdion > a-t sa.dxrxtxax xtxlxoxsx xsxIxcn > t-ehtrxex xhxnxix xoxkx,xax x xax > eAed danptns yenetxig > vnr hop'e sah ro.hxnx > Here's my contribution (finally). I resisted the urge to look at the spoilers, but the hint from Richard to MM (about the word "encrypt") did help. I had to add some spaces at the end of some lines below to make them equal length (copy/paste thingy). I also may have made some off-by-one error somewhere in the decryption. yI mua b tilatl oot etpxr ,'b t Iif naleytg thi .axt yIlpooiigeaI dhd 'p iheas orkmns t tienstoclert,b taRtcoagd iate to dMid dh lihhurhsIhhnvs foraMm titxa .hxl xexp mT rape tni ge riph u cnilnd.d yocmykt ahdndscrygttfInitcousex mBnt na eranf lonsmd us.axg eothatdkp i tite ateoat xrxu Ihmtnstwsyrt eoe atehtnalysie physltnxs.s t'a 'o hu ehhrw ir na dne nmtti ieet xo tIa betrwpisdRtcoagd. xe t dic yetr ihhurhsxtxx lIn llnotp,do hirei eoma mnlripli nfx4 iteaesg ha stlenwsst y euctypteoox x amlt.ox ieshxdxf rbps.6y yatep4xc oIeE1dcNVLKJNbc95ecRdbW4FaK15bZJFIbNlc KyDvvXGyu2Hp5iywhXmo22zKdWSwy3W0kHG5uw 5ZcMRKaoAZJ9xIJwkaI4AeIoxIdAAIIBxIb0hb yX3oyQXKom1yuGygKWCggDGKwCCg9HG0lDigwC AdIkBIdAAIPlAIexIdKAQIbQBIJ0QMCoAIIAAI gCCKwCCgrGSmiGCwqCDltDHg0TTgpDiKgCCggC BILAIbaB0Ic0RbaV0KZB9KIooIaA4Yc1FcZRUb 0CzgrHl0rDHgbGlugHm0yQGggCWggjmbuH2boH tbXBBLbIIXaoBIbABcYJ5bZQhIZI4aY9kbIhlY pHS0mz3pgQSgpCigyHWpnnSgsiWuomippiGbml 9IbkhJYAtIX0BIbBIKaoBIbABcYJ5bZQhIZI4a pGigbSlypDS9mD3dgQSgpCigyHWpnnSgsiWuom IYFkKIolIIAkIJoACI=0 DidpQGKmCGggASKygD=9 rbps.6y xe yatep4xdxc MICEgdbNBLbJhbe9MeYRJbd4sCXlkcc9VdZBxe Kynv9X3yl2ipziXwuXXon2lKxmStuGmyhCGzpX 4bYVkKIk0CbRVZKBIKOEoYIkACIAAIIBBZaB5Z omSzgCTKgmGluiGtpGgsgiC6giCggCHpyiWs0W YIbJEYMQ0CMAoIIBAYIAAIIxBbKh0KIoIIIAAa gCGilWji9iDgKCCsgSC9gGClhizhiQCgKCCggW AIIABIPBEKI0AIIIBIPAIICAAIIBBYaAlPZABC gCCgpCTiKzCigCHK0CSgiCiggCCs3SGrsSSxpi xIXwAbIEJMaoVIYA0ICAAIIBAdIAAPaAAYPtAJ hDSgrGGqbjSKsCVgpCiggCCwgCCrgSSorVSpyW dCKAxIbBhZKR8cK4ocIQACIZBcaB5IIl0IeJtb liGglCiy4XS1ymTgKHCKgmHvyiWs0GGuoHFhsm bKsJXL5JcdRJacAgJXx4JKkxCWoI CjxdSnyz3HypXCon1GunySp4gzKq zO xz
[toc] | [prev] | [next] | [standalone]
| From | Richard Heathfield <rjh@cpax.org.uk> |
|---|---|
| Date | 2021-09-25 05:24 +0100 |
| Message-ID | <sim89a$9bq$1@dont-email.me> |
| In reply to | #50109 |
On 25/09/2021 01:24, wizzofozz wrote: > Here's my contribution (finally). I resisted the urge to look at the > spoilers, but the hint from Richard to MM (about the word "encrypt") did > help. > I had to add some spaces at the end of some lines below to make them > equal length (copy/paste thingy). I also may have made some off-by-one > error somewhere in the decryption. I got the gist of your enciphered message, but I think I should confess (as I've already hinted upthread) that my decipher code didn't do a stellar job, cobbled together as it was in a few minutes, so I'm not surprised that others, too, have struggled a bit with decryption. I suspect I went from Grand Concept to Code Central far too quickly without lingering long enough in Thought Parkway. Congratulations, therefore are certainly due to yourself and others who managed to bolt a few missing wheels onto my train. CHAL2 is very different. I have tested encryption and decryption thoroughly, and have even gone to the trouble of doing the bitmap header thing to make encrypted bitmaps viewable, and it works both ways (bmp -> encrypted viewable bitmap -> decrypted original file). So the second challenge is fair. No takers so far, so you're not too late! -- Richard Heathfield Email: rjh at cpax dot org dot uk "Usenet is a strange place" - dmr 29 July 1999 Sig line 4 vacant - apply within
[toc] | [prev] | [next] | [standalone]
| From | Richard Harnden <richard.nospam@gmail.com> |
|---|---|
| Date | 2021-09-25 13:56 +0100 |
| Message-ID | <sin69v$4i2$1@dont-email.me> |
| In reply to | #50057 |
On 20/09/2021 10:17, Richard Heathfield wrote:
> lFcrdtwo,econ you itelt nx
> ook ohns af you sdinliofy
> ttie aegtrxtxmxuxex xoxexcxyt
> hhs tlxo?ixhx xsxdxtx xnxrxpx
> tFar eat apcrexim,tc t semr poexx
> hot cxnra prodita eua doceyctdion
> a-t sa.dxrxtxax xtxlxoxsx xsxIxcn
> t-ehtrxex xhxnxix xoxkx,xax x xax
> eAed danptns yenetxig
> vnr hop'e sah ro.hxnx
>
Here's my chatx encoder/decoder effort.
I spent far too much time on this.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX_LINE 1024
typedef void (*chatx_t)(FILE *in);
static int encode_read_pair(FILE *in, char *a, char *b)
{
int a_length;
int b_length;
char *z;
if ( fgets(a, MAX_LINE, in) == NULL )
return 0;
z = strchr(a, '\n');
if ( z == NULL )
{
fprintf(stderr, "Line too long.\n");
exit(EXIT_FAILURE);
}
*z = '\0';
a_length = z - a;
if ( fgets(b, MAX_LINE, in) == NULL )
b_length = 0;
else
{
z = strchr(b, '\n');
if ( z == NULL )
{
fprintf(stderr, "Line too long.\n");
exit(EXIT_FAILURE);
}
*z = '\0';
b_length = z - b;
}
if ( a_length == 0 )
{
a_length = 2;
a[0] = 'x';
a[1] = 'x';
a[2] = '\0';
}
else
{
if ( a_length % 2 == 1 )
{
a[a_length++] = 'x';
a[a_length] = '\0';
}
}
if ( b_length == 0 )
{
b_length = 2;
b[0] = 'x';
b[1] = 'x';
b[2] = '\0';
}
else
{
if ( b_length % 2 == 1 )
{
b[b_length++] = 'x';
b[b_length] = '\0';
}
}
if ( a_length > b_length )
{
for (int i=b_length; i<a_length; i++)
b[i] = 'x';
b_length = a_length;
b[b_length] = '\0';
}
if ( b_length > a_length )
{
for (int i=a_length; i<b_length; i++)
a[i] = 'x';
a_length = b_length;
a[a_length] = '\0';
}
return a_length;
}
static void chatx_encode(FILE *in)
{
char a[MAX_LINE];
char b[MAX_LINE];
char c[MAX_LINE];
char d[MAX_LINE];
int length;
char p,q,r,s;
int c_pos;
int d_pos;
while (1)
{
c_pos = 0;
d_pos = 0;
if ( (length = encode_read_pair(in, a, b)) == 0 )
break;
for (int i=0; i<length; i+=2)
{
p = a[i];
q = a[i+1];
r = b[i];
s = b[i+1];
c[c_pos++] = r;
c[c_pos++] = p;
d[d_pos++] = s;
d[d_pos++] = q;
}
c[length] = '\0';
d[length] = '\0';
puts(c);
puts(d);
}
}
static int decode_read_pair(FILE *in, char *a, char *b)
{
int a_length;
int b_length;
char *z;
if ( fgets(a, MAX_LINE, in) == NULL )
return 0;
z = strchr(a, '\n');
if ( z == NULL )
{
fprintf(stderr, "Line too long.\n");
exit(EXIT_FAILURE);
}
*z = '\0';
a_length = z - a;
if ( fgets(b, MAX_LINE, in) == NULL )
{
fprintf(stderr, "Expected pair of lines.\n");
exit(EXIT_FAILURE);
}
z = strchr(b, '\n');
if ( z == NULL )
{
fprintf(stderr, "Line too long.\n");
exit(EXIT_FAILURE);
}
*z = '\0';
b_length = z - b;
if ( a_length != b_length )
{
fprintf(stderr, "Line pair has different lengths.");
exit(EXIT_FAILURE);
}
if ( a_length % 2 != 0 )
{
fprintf(stderr,
"Expected lines to be even number of characters.");
exit(EXIT_FAILURE);
}
return a_length;
}
static void chatx_decode(FILE *in)
{
char a[MAX_LINE];
char b[MAX_LINE];
char c[MAX_LINE];
char d[MAX_LINE];
int length;
char p,q,r,s;
int c_pos;
int d_pos;
while (1)
{
c_pos = 0;
d_pos = 0;
if ( (length = decode_read_pair(in, a, b)) == 0 )
break;
for (int i=0; i<length; i+=2)
{
p = a[i];
q = a[i+1];
r = b[i];
s = b[i+1];
c[c_pos++] = q;
c[c_pos++] = s;
d[d_pos++] = p;
d[d_pos++] = r;
}
c[length] = '\0';
d[length] = '\0';
puts(c);
puts(d);
}
}
int main(int argc, char *argv[])
{
chatx_t chatx = chatx_encode;
if ( argc > 2 )
{
fprintf(stderr, "Usage: %s [-d]\n", argv[0]);
return EXIT_FAILURE;
}
if ( argc == 2 )
{
if ( strcmp(argv[1], "-d") == 0 )
chatx = chatx_decode;
else
{
if ( strcmp(argv[1], "-e") == 0 )
chatx = chatx_encode;
else
{
fprintf(stderr, "Usage: %s [-d]\n", argv[0]);
return EXIT_FAILURE;
}
}
}
chatx(stdin);
return 0;
}
[toc] | [prev] | [next] | [standalone]
| From | Richard Heathfield <rjh@cpax.org.uk> |
|---|---|
| Date | 2021-09-25 14:21 +0100 |
| Message-ID | <sin7pb$f88$1@dont-email.me> |
| In reply to | #50120 |
On 25/09/2021 13:56, Richard Harnden wrote:
> On 20/09/2021 10:17, Richard Heathfield wrote:
>> lFcrdtwo,econ you itelt nx
>> ook ohns af you sdinliofy
>> ttie aegtrxtxmxuxex xoxexcxyt
>> hhs tlxo?ixhx xsxdxtx xnxrxpx
>> tFar eat apcrexim,tc t semr poexx
>> hot cxnra prodita eua doceyctdion
>> a-t sa.dxrxtxax xtxlxoxsx xsxIxcn
>> t-ehtrxex xhxnxix xoxkx,xax x xax
>> eAed danptns yenetxig
>> vnr hop'e sah ro.hxnx
>>
>
> Here's my chatx encoder/decoder effort.
> I spent far too much time on this.
>
>
> #include <stdio.h>
> #include <stdlib.h>
> #include <string.h>
>
> #define MAX_LINE 1024
>
> typedef void (*chatx_t)(FILE *in);
>
> static int encode_read_pair(FILE *in, char *a, char *b)
> {
> int a_length;
> int b_length;
> char *z;
>
> if ( fgets(a, MAX_LINE, in) == NULL )
> return 0;
>
> z = strchr(a, '\n');
> if ( z == NULL )
> {
> fprintf(stderr, "Line too long.\n");
> exit(EXIT_FAILURE);
> }
>
> *z = '\0';
> a_length = z - a;
>
> if ( fgets(b, MAX_LINE, in) == NULL )
> b_length = 0;
> else
> {
> z = strchr(b, '\n');
> if ( z == NULL )
> {
> fprintf(stderr, "Line too long.\n");
> exit(EXIT_FAILURE);
> }
>
> *z = '\0';
> b_length = z - b;
> }
>
> if ( a_length == 0 )
> {
> a_length = 2;
> a[0] = 'x';
> a[1] = 'x';
> a[2] = '\0';
> }
> else
> {
> if ( a_length % 2 == 1 )
> {
> a[a_length++] = 'x';
> a[a_length] = '\0';
> }
> }
>
> if ( b_length == 0 )
> {
> b_length = 2;
> b[0] = 'x';
> b[1] = 'x';
> b[2] = '\0';
> }
> else
> {
> if ( b_length % 2 == 1 )
> {
> b[b_length++] = 'x';
> b[b_length] = '\0';
> }
> }
>
> if ( a_length > b_length )
> {
> for (int i=b_length; i<a_length; i++)
> b[i] = 'x';
>
> b_length = a_length;
> b[b_length] = '\0';
> }
>
> if ( b_length > a_length )
> {
> for (int i=a_length; i<b_length; i++)
> a[i] = 'x';
>
> a_length = b_length;
> a[a_length] = '\0';
> }
>
> return a_length;
> }
>
> static void chatx_encode(FILE *in)
> {
> char a[MAX_LINE];
> char b[MAX_LINE];
> char c[MAX_LINE];
> char d[MAX_LINE];
> int length;
> char p,q,r,s;
> int c_pos;
> int d_pos;
>
> while (1)
> {
> c_pos = 0;
> d_pos = 0;
>
> if ( (length = encode_read_pair(in, a, b)) == 0 )
> break;
>
> for (int i=0; i<length; i+=2)
> {
> p = a[i];
> q = a[i+1];
> r = b[i];
> s = b[i+1];
>
> c[c_pos++] = r;
> c[c_pos++] = p;
>
> d[d_pos++] = s;
> d[d_pos++] = q;
> }
>
> c[length] = '\0';
> d[length] = '\0';
>
> puts(c);
> puts(d);
> }
> }
>
> static int decode_read_pair(FILE *in, char *a, char *b)
> {
> int a_length;
> int b_length;
> char *z;
>
> if ( fgets(a, MAX_LINE, in) == NULL )
> return 0;
>
> z = strchr(a, '\n');
> if ( z == NULL )
> {
> fprintf(stderr, "Line too long.\n");
> exit(EXIT_FAILURE);
> }
>
> *z = '\0';
> a_length = z - a;
>
> if ( fgets(b, MAX_LINE, in) == NULL )
> {
> fprintf(stderr, "Expected pair of lines.\n");
> exit(EXIT_FAILURE);
> }
>
> z = strchr(b, '\n');
> if ( z == NULL )
> {
> fprintf(stderr, "Line too long.\n");
> exit(EXIT_FAILURE);
> }
>
> *z = '\0';
> b_length = z - b;
>
> if ( a_length != b_length )
> {
> fprintf(stderr, "Line pair has different lengths.");
> exit(EXIT_FAILURE);
> }
>
> if ( a_length % 2 != 0 )
> {
> fprintf(stderr,
> "Expected lines to be even number of characters.");
> exit(EXIT_FAILURE);
> }
>
> return a_length;
> }
>
> static void chatx_decode(FILE *in)
> {
> char a[MAX_LINE];
> char b[MAX_LINE];
> char c[MAX_LINE];
> char d[MAX_LINE];
> int length;
> char p,q,r,s;
> int c_pos;
> int d_pos;
>
> while (1)
> {
> c_pos = 0;
> d_pos = 0;
>
> if ( (length = decode_read_pair(in, a, b)) == 0 )
> break;
>
> for (int i=0; i<length; i+=2)
> {
> p = a[i];
> q = a[i+1];
> r = b[i];
> s = b[i+1];
>
> c[c_pos++] = q;
> c[c_pos++] = s;
>
> d[d_pos++] = p;
> d[d_pos++] = r;
> }
>
> c[length] = '\0';
> d[length] = '\0';
>
> puts(c);
> puts(d);
> }
> }
>
> int main(int argc, char *argv[])
> {
> chatx_t chatx = chatx_encode;
>
> if ( argc > 2 )
> {
> fprintf(stderr, "Usage: %s [-d]\n", argv[0]);
> return EXIT_FAILURE;
> }
>
> if ( argc == 2 )
> {
> if ( strcmp(argv[1], "-d") == 0 )
> chatx = chatx_decode;
> else
> {
> if ( strcmp(argv[1], "-e") == 0 )
> chatx = chatx_encode;
> else
> {
> fprintf(stderr, "Usage: %s [-d]\n", argv[0]);
> return EXIT_FAILURE;
> }
> }
> }
>
> chatx(stdin);
>
> return 0;
> }
>
I tried it on the puzzle ciphertext and came across an oddity.
rjh@here$ ./hdc < t3.cipher
olkcodnw ,ac noy udineitfn
oF rhtso efoy uos itllo yx
htsit xe?txxxxxxxxxxxxxxxxxxxt
ht elaogirht msudet onercpyxx
httac naa pporixameta d ceyrtpienx
oF rxert arcdeti ,uc tosemc dooxxx
taettsx.xxxxxxxxxxxxxxxxxxxxxxxxxn
--h raed rhtnai tolko,sa s Iacxx
vereh paepsnh re.exxxg
nA dod'n tas yonhtnixx
rjh@here$ cat t3.cipher | wc -l
10
rjh@here:~/alldata/dev/crypto/sqspin/harndendecrypt$ ./hdc -d < t3.cipher
For those of you still oxy
lockdown, can you identinf
Expected lines to be even number of characters.
Last I checked, 10 is even. :-)
NO! For heaven's sake don't waste time fixing it on my account. My
decoder's screwed too and I'm letting it go.
--
Richard Heathfield
Email: rjh at cpax dot org dot uk
"Usenet is a strange place" - dmr 29 July 1999
Sig line 4 vacant - apply within
[toc] | [prev] | [next] | [standalone]
| From | Richard Heathfield <rjh@cpax.org.uk> |
|---|---|
| Date | 2021-09-25 14:28 +0100 |
| Message-ID | <sin85j$hlr$1@dont-email.me> |
| In reply to | #50121 |
On 25/09/2021 14:21, Richard Heathfield wrote: > I tried it on the puzzle ciphertext and came across an oddity. > > > rjh@here$ ./hdc < t3.cipher I didn't mean to post that! Broadly: Step 1: wc -l reports 10 lines of ciphertext. Step 2: Richard Harnden's decoder reports odd number of lines. Step 3: Contemplate that Richard Heathfield's decoder is screwed too. Step 4: Break open a beer. -- Richard Heathfield Email: rjh at cpax dot org dot uk "Usenet is a strange place" - dmr 29 July 1999 Sig line 4 vacant - apply within
[toc] | [prev] | [next] | [standalone]
| From | wizzofozz <oxxxxxxxxxxxs@gmail.com> |
|---|---|
| Date | 2021-09-25 16:11 +0200 |
| Message-ID | <sinan7$4m8$1@dont-email.me> |
| In reply to | #50120 |
Op 25-9-2021 om 14:56 schreef Richard Harnden: > On 20/09/2021 10:17, Richard Heathfield wrote: >> lFcrdtwo,econ you itelt nx >> ook ohns af you sdinliofy >> ttie aegtrxtxmxuxex xoxexcxyt >> hhs tlxo?ixhx xsxdxtx xnxrxpx >> tFar eat apcrexim,tc t semr poexx >> hot cxnra prodita eua doceyctdion >> a-t sa.dxrxtxax xtxlxoxsx xsxIxcn >> t-ehtrxex xhxnxix xoxkx,xax x xax >> eAed danptns yenetxig >> vnr hop'e sah ro.hxnx >> > > Here's my chatx encoder/decoder effort. > I spent far too much time on this. That's a bit inherit to accepting these kind of tasks. I tried your version (reading from stdin and encrypt) and it seems to be compatible with my decrypt. So just to let you know it compiles on my system and has been run by at least 3 people now. Your time has not been wasted ;-) (as a side effect I had to install gcc in my WSL which is good use of my time as well). Ozz
[toc] | [prev] | [standalone]
Page 2 of 2 — ← Prev page 1 [2]
Back to top | Article view | sci.crypt
csiph-web