From: ellie.odonnell.iei8 on
Hi,

I need to write a very simple one-way encryption alogorithm in COBOL.
It must not be able to be decrypted. I thought I could simply use the
UNSTRING function to separate all the characters in the field, convert
them to something else, and then STRING all the characters back
together into the field, but that is not working. I also thought there
was a way to count all the characters in a string, but it seems like
the COUNT verb is to count fields in a record, not individual
characters.

I have an encryption algorithm to use for numeric values, but am having
a lot of trouble figuring out what to do about the alpha character
strings.

If only there were a RANDOMIZE function for character strings!!

Please help!!

Thanks!
Ellie

From: docdwarf on
In article <1120234427.622603.211450(a)g43g2000cwa.googlegroups.com>,
<ellie.odonnell.iei8(a)statefarm.com> wrote:
>Hi,
>
>I need to write a very simple one-way encryption alogorithm in COBOL.
>It must not be able to be decrypted.

So you just need to put garbage in a particular field?

DD

From: Arnold Trembley on


ellie.odonnell.iei8(a)statefarm.com wrote:
> Hi,
>
> I need to write a very simple one-way encryption alogorithm in COBOL.
> It must not be able to be decrypted. I thought I could simply use the
> UNSTRING function to separate all the characters in the field, convert
> them to something else, and then STRING all the characters back
> together into the field, but that is not working. I also thought there
> was a way to count all the characters in a string, but it seems like
> the COUNT verb is to count fields in a record, not individual
> characters.
>
> I have an encryption algorithm to use for numeric values, but am having
> a lot of trouble figuring out what to do about the alpha character
> strings.
>
> If only there were a RANDOMIZE function for character strings!!
>
> Please help!!
>
> Thanks!
> Ellie
>

A "hashing algorithm" might do what you want.

From Joel C. Ewing in bit.listserv.ibm-mail on March 16, 2001 (you
can find it with google advanced newsgroup search):

"A trivial hashing function that works adequately in many cases is to
take your data entry "key" field 4-bytes at a time, XOR these
together, take absolute value, and then mod N' (i.e., remainder of
division by N' - Constraining N' to a prime tends to improve the
dispersion) and then use this..."

Of course, XOR'ing binary fields in COBOL might be a little bit
difficult to do without a library routine or assembler subprogram.

If your function is truly trivial, you might just break up your "key"
field into two-byte subfields, coerce each one to be a PIC S9(4) COMP
field (I'm assuming IBM mainframe COBOL here), and simply add each
number together, truncating the results. The final two-byte binary
number cannot possibly be decrypted back to the original value, and
will give you approximately 32,767 semi-random results.

Perhaps someone else can suggest a simpler or more secure hashing
algorithm.

I hope that helps.

--
http://arnold.trembley.home.att.net/

From: HeyBub on
ellie.odonnell.iei8(a)statefarm.com wrote:
> Hi,
>
> I need to write a very simple one-way encryption alogorithm in COBOL.
> It must not be able to be decrypted. I thought I could simply use the
> UNSTRING function to separate all the characters in the field, convert
> them to something else, and then STRING all the characters back
> together into the field, but that is not working. I also thought there
> was a way to count all the characters in a string, but it seems like
> the COUNT verb is to count fields in a record, not individual
> characters.
>
> I have an encryption algorithm to use for numeric values, but am
> having a lot of trouble figuring out what to do about the alpha
> character strings.
>
> If only there were a RANDOMIZE function for character strings!!
>
> Please help!!
>
> Thanks!
> Ellie

Check your mail


From: ellie.odonnell.iei8 on
Yes, I need to put garbage in most of the fields on the file. But the
resulting fields need to be the same data type and length as the
original fields. CHAR (15) needs to be CHAR(15) when I'm done with it,
etc. And the file itself needs to remain the same length.

 |  Next  |  Last
Pages: 1 2 3
Prev: free reports tool
Next: Visual Object Cobol dll and VB5