Hi guys. I need to translate some C code into Perl. I want to decrypt NS1crypted stuff on solaris. There is a tool written in C by the opensolaris project.

(http://stuff.iain.cx/2008/05/03/ns103eb2365be169abbe3a45088a10a/)

I need a Perlscript what does the same thing so i started to translate this code. But I kinda stuck in a function where I keep getting different return values. Here's the C code i want to translate:

http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/lib/libsldap/common/ns_crypt.c

I stuck in the c_setup function.

Perlcode: http://pastebin.com/ucg6V0Ce

I guess it's some stuff with signed-overflow integers in the C-code but I don't really have an idea. I'm trying this for days now.. please help me. regards,bottch


In reply to C code translation to Perl by bottch

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.