Bitcoin Forum
April 26, 2024, 08:59:56 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: PHP Secret Key Generating Script  (Read 974 times)
williamj2543 (OP)
Hero Member
*****
Offline Offline

Activity: 588
Merit: 500

Get ready for PrimeDice Sig Campaign!


View Profile WWW
September 28, 2014, 07:38:25 AM
 #1

I have made a very short secret generating script for if you need to make secret keys for casinos. This makes 3650 days worth of keys (you can easily make more, just change one number) to last 10 years. It generates and inserts the original secret (the thing you use and reveal 24 hours later), and the encrypted version which you release instantly, and it there at any time. It also associates a day per each pair. It inserts it all into a mysql database, but you can obviously change this, maybe insert into a csv file or something else. It is written in php.
This assumes you have a table with 3 columns, date, hash, and secret. You can change the table name if you want, and the hash algorithm. Its up to you what you do with it.
Source code:

Code:
<?php
require('conn.php');
// ^ connect to the database on this line. The mysql connection is on the object $db
$e=1;
$start_date date('n/j/Y');
for (
$i 1$i <= 3650$i++) {
$next_date strtotime($e++." day"strtotime($start_date));
$date date('n/j/Y',$next_date);
    
$key substr(str_shuffle(abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ),01) . substr(str_shuffle(aBcEeFgHiJkLmNoPqRstUvWxYz0123456789),031);
    
$hashkey hash('sha256'$key);
    
$stmt $db->prepare('INSERT INTO crypti_secrets (date, hash, secret) VALUES (:date, :hash, :secret)');
$result $stmt->execute(array(
'date' => $date,
'hash' => $hashkey,
'secret' => $key,
));
}
?>
Please donate if you found this helpful: 16MtvTUvqwwKwV87nayxPLHTJJZNGPa9qw

█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████
▓▓▓▓▓  BIT-X.comvvvvvvvvvvvvvvi
→ CREATE ACCOUNT 
▓▓▓▓▓
█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████
1714121996
Hero Member
*
Offline Offline

Posts: 1714121996

View Profile Personal Message (Offline)

Ignore
1714121996
Reply with quote  #2

1714121996
Report to moderator
1714121996
Hero Member
*
Offline Offline

Posts: 1714121996

View Profile Personal Message (Offline)

Ignore
1714121996
Reply with quote  #2

1714121996
Report to moderator
1714121996
Hero Member
*
Offline Offline

Posts: 1714121996

View Profile Personal Message (Offline)

Ignore
1714121996
Reply with quote  #2

1714121996
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714121996
Hero Member
*
Offline Offline

Posts: 1714121996

View Profile Personal Message (Offline)

Ignore
1714121996
Reply with quote  #2

1714121996
Report to moderator
1714121996
Hero Member
*
Offline Offline

Posts: 1714121996

View Profile Personal Message (Offline)

Ignore
1714121996
Reply with quote  #2

1714121996
Report to moderator
1714121996
Hero Member
*
Offline Offline

Posts: 1714121996

View Profile Personal Message (Offline)

Ignore
1714121996
Reply with quote  #2

1714121996
Report to moderator
TCM
Sr. Member
****
Offline Offline

Activity: 251
Merit: 250


View Profile
September 28, 2014, 10:07:08 AM
 #2

Are you sure this is strong randomness?
williamj2543 (OP)
Hero Member
*****
Offline Offline

Activity: 588
Merit: 500

Get ready for PrimeDice Sig Campaign!


View Profile WWW
September 28, 2014, 04:32:32 PM
 #3

Are you sure this is strong randomness?
Yes, I don't see why it isnt. Its just making random characters so we don't need that to be random.

█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████
▓▓▓▓▓  BIT-X.comvvvvvvvvvvvvvvi
→ CREATE ACCOUNT 
▓▓▓▓▓
█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████
evilimprint
Newbie
*
Offline Offline

Activity: 24
Merit: 0


View Profile
September 28, 2014, 07:28:42 PM
 #4

why not just use GUID almost all enterprise platforms use it. It is simple to use and generates completely random strings ex(c184964b-2263-40a0-8f4d-33d0696e452b)

http://php.net/manual/en/function.com-create-guid.php
williamj2543 (OP)
Hero Member
*****
Offline Offline

Activity: 588
Merit: 500

Get ready for PrimeDice Sig Campaign!


View Profile WWW
September 28, 2014, 07:37:22 PM
 #5

You could use a GUID but it doesn't really matter, as long as it is long enough (not brute forceable) its fine.

█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████
▓▓▓▓▓  BIT-X.comvvvvvvvvvvvvvvi
→ CREATE ACCOUNT 
▓▓▓▓▓
█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!