Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

php decimal hash wanted: like md5() but should only return numbers

Posted on 2008-06-18
5
Medium Priority
?
1,265 Views
Last Modified: 2008-06-19
Hello,

I want a PHP function to return a 10 digit hash that only contains numbers.  I cannot use MD5 because it returns the letters a through d as well as numbers.
0
Comment
Question by:hankknight
  • 2
  • 2
5 Comments
 
LVL 5

Accepted Solution

by:
Alex-w474 earned 2000 total points
ID: 21818435
You can use crc32: http://php.net/manual/en/function.crc32.php
printf('%u', crc32($text));

Open in new window

0
 
LVL 49

Expert Comment

by:Roonaan
ID: 21820159
have you tried:

$hash = rand(1000000000,9999999999);
0
 
LVL 5

Expert Comment

by:Alex-w474
ID: 21820363
>have you tried:
>$hash = rand(1000000000,9999999999);

It is not a hash as per it is.
0
 
LVL 49

Expert Comment

by:Roonaan
ID: 21820386
Yeah, sorry. That's just a random number.
0
 
LVL 16

Author Comment

by:hankknight
ID: 21822702
Alex-w474.

crc32 meets my needs perfectly.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.
Suggested Courses

926 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question