# MD5 in Natural?

**URL:** <https://techcommunity.softwareag.com/t/md5-in-natural/79696>\
**Category:** Forum\
**Tags:** Adabas-Natural, Natural, Natural-on-Mainframes\
**Created:** [December 4, 2008, 3:18pm UTC](https://techcommunity.softwareag.com/t/md5-in-natural/79696 "2008-12-04T15:18:54Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matthias1](https://avatars.discourse-cdn.com/v4/letter/m/9fc348/32.png) [@Matthias1](https://techcommunity.softwareag.com/u/Matthias1)\
**Post date:** [December 4, 2008, 3:18pm UTC](https://techcommunity.softwareag.com/t/md5-in-natural/79696/1 "2008-12-04T15:18:54Z")

</div>

Hallo all!

Has anybody written a real Natural-Implementation of the md5-Algorithm?(info: [MD5 - Wikipedia](http://en.wikipedia.org/wiki/MD5) )

I think: In C, Java, perl etc. it’s not that difficult. But Natural is not really good for this (no unsigned little endian integers, no bitwise OR/XOR).

Any ideas to solve this?

Thanks,

Matthias

---

<div class="post-metadata">

**Author:** ![Brian\_Johnson1](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/brian_johnson1/32/163_2.png) [@Brian\_Johnson1](https://techcommunity.softwareag.com/u/Brian_Johnson1)\
**Post date:** [December 4, 2008, 6:57pm UTC](https://techcommunity.softwareag.com/t/md5-in-natural/79696/2 "2008-12-04T18:57:28Z")

</div>

You’re right. Natural is good for writing business applications, not scientific apps. Best would be to write the module in C or assembler, then call it from Natural.

---

<div class="post-metadata">

**Author:** ![Matthias1](https://avatars.discourse-cdn.com/v4/letter/m/9fc348/32.png) [@Matthias1](https://techcommunity.softwareag.com/u/Matthias1)\
**Post date:** [December 4, 2008, 8:53pm UTC](https://techcommunity.softwareag.com/t/md5-in-natural/79696/3 "2008-12-04T20:53:46Z")

</div>

I think it’s less scientific than it sounds. A few months ago I would have used it to store passwords (i.e. to store the hash of it). Now I would need it for data comparisons (i.e. compare checksums to find out, whether it has been changed or not).

Well, sounds like I got no choice.

---

<div class="post-metadata">

**Author:** ![Ralph\_Zbrog](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/ralph_zbrog/32/78_2.png) [@Ralph\_Zbrog](https://techcommunity.softwareag.com/u/Ralph_Zbrog)\
**Post date:** [December 4, 2008, 10:31pm UTC](https://techcommunity.softwareag.com/t/md5-in-natural/79696/4 "2008-12-04T22:31:56Z")

</div>

Perhaps USR4011N would suffice.

---

<div class="post-metadata">

**Author:** ![Matthias1](https://avatars.discourse-cdn.com/v4/letter/m/9fc348/32.png) [@Matthias1](https://techcommunity.softwareag.com/u/Matthias1)\
**Post date:** [December 8, 2008, 12:42pm UTC](https://techcommunity.softwareag.com/t/md5-in-natural/79696/5 "2008-12-08T12:42:35Z")

</div>

> [@Ralph Zbrog](#):
>
> Perhaps USR4011N would suffice.

Thank you. I did a search for “md5” in SYSEXT, so I didn’t find other algorithms :oops:

---

<div class="post-metadata">

**Author:** ![Matthias1](https://avatars.discourse-cdn.com/v4/letter/m/9fc348/32.png) [@Matthias1](https://techcommunity.softwareag.com/u/Matthias1)\
**Post date:** [December 9, 2008, 7:14pm UTC](https://techcommunity.softwareag.com/t/md5-in-natural/79696/6 "2008-12-09T19:14:09Z")

</div>

One little remark:

A zero length input results in hash = H’0000000’.

```auto
define data local
1 #b (B) dynamic
1 #b156 (B156)
1 #hash (B20)
end-define
callnat 'USR4011N' 0 #b156 #b #hash
display #hash
end
```

That’s incorrect. [Secure Hash Algorithm – Wikipedia](http://de.wikipedia.org/wiki/SHA1#SHA-1) says, that a null-String has the sha1-hash H’da39a3ee5e6b4b0d3255bfef95601890afd80709’

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [April 2, 2021, 2:51pm UTC](https://techcommunity.softwareag.com/t/md5-in-natural/79696/7 "2021-04-02T14:51:15Z")

</div>


