Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: crypt function has string length limit?

by sundialsvc4 (Abbot)
on Jul 24, 2017 at 15:57 UTC ( [id://1195886]=note: print w/replies, xml ) Need Help??


in reply to crypt function has string length limit?

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re^2: crypt function has string length limit?
by shmem (Chancellor) on Jul 24, 2017 at 16:48 UTC
    The CPAN library contains both pure-Perl and XS (binary) implementations of crypt() functions, although you would have to experiment or check the source-code to see if they follow the 8-character password convention.

    Actually, perls builtin crypt uses the crypt(3) the platform provides, on which perl has been compiled. If the platform sports glibc2, then perls builtin crypt supports all crypting flavors the glibc2 crypt(3) provides.

    So, to use a better crypt, on a modern system no CPAN modules are necessary, just check the manpage of crypt(3). To wit:

    If salt is a character string starting with the characters "$id$" followed by a string terminated by "$":

    IDMethod
    1MD5
    2aBlowfish (not in mainline glibc; added in some Linux distributions)
    5SHA-256 (since glibc 2.7)
    6SHA-512 (since glibc 2.7)

    The DES algorithm taking a 2-char salt and a 8-char password is considered insecure, as are MD5 and SHA1. Don't use them..

    The post I am replying to is yet another example of sundialsvc4 providing outdated and therefore possibly harmful information. See man crypt on your system.

    sundialsvc4, please update your knowledge every now and then by RTFM. See my sig; and see jackass.

    perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'
    perl -E '($what = FOOL & MONK)=~s/(.)$/chr((ord$1)+12)/e; say $what'
Re^2: crypt function has string length limit?
by Eily (Monsignor) on Jul 24, 2017 at 16:28 UTC

    From Wikipedia

    SHA-1 is no longer considered secure against well-funded opponents. In 2005, cryptanalysts found attacks on SHA-1 suggesting that the algorithm might not be secure enough for ongoing use,, and since 2010 many organizations have recommended its replacement by SHA-2 or SHA-3

    Sure, it's still more secure than crypt (edit: at least the version of crypt discussed in the OP), but your very long paragraph makes it sound like it's some sort of perfect magical solution. Salting isn't specific to SHA, actually you can just add your salt at the end of your input data and call it salting as long the algorithm accepts arbitrary length. And SHA-1 is "thought" to be more-secure than MD5: well MD5 outputs 128 bits of data, against 160 for SHA-1. I'd say it's around 32 bits more secure .

    Edit: oh and you may get an unlimited number of password/salt combinations. But no matter how often you change the salt, you won't get more than 2^160 different output values.

    Edit: The wikipedia page for SHA-1 actually has a comparison of hash functions which gives one less bit of information for SHA-1 than MD5. So I remove my claim about the 32 bits additional security. And this directly contradicts your claim that "SHA1 is thought to be a more-secure algorithm than MD5".

Re^2: crypt function has string length limit?
by zentara (Archbishop) on Jul 24, 2017 at 16:09 UTC
      An interesting result. That type of attack is mostly effective against smartcards and other "secure hardware" devices. Basically, if someone has physical access to a piece of technology, they can get the secrets out of it somehow. Also, 1024-bit RSA keys have been considered insufficient for like 15 years.

      An interesting, non-mathematical attack. No doubt, there's a way to do that with hashing algorithms, as well.

      Though, as soon as a big enough quantum computer can be built, the RSA algorithm is doomed (Shor's algorithm)

      (Also, in Australia, mathematical laws don't apply.)

Re^2: crypt function has string length limit?
by hippo (Bishop) on Jul 24, 2017 at 16:32 UTC
    SHA1 is thought to be a more-secure algorithm than MD5

    A prison consisting of a dry paper bag is more secure that one consisting of a wet paper bag but neither of them is sufficient to stop a criminal escaping. Nobody should be using either SHA1 or MD5 for any remotely important crytographic purpose in 2017 and your advice to use it is either ignorant, incompetent or sociopathic.

A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1195886]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (4)
As of 2024-03-29 00:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found