I just tried generating and saving 50,000 hashids to my database as a test for my Laravel app and it doesn't seem that the padding parameter is being respected. I'm seeing plenty of IDs lower than requested, some consisting of just one digit, as well as a few hundred duplicates.
Here is the model code I used to generate the IDs, which passes a minimum length of 8 digits:
public static function generatePaymentID($request) {
...
$transaction->save(); // First save to ensure transaction->id is populated
...
$hashids = new Hashids('projectnamesalt', 8, "ABCDEFGHJKLMNPQRSTUVWXYZ23456789");
$transaction->payment_id = $hashids->encode($transaction->id);
...
$transaction->save();
}
And here's the quick-and-dirty for loop I'm using to run the above function as part of my migration (as I said, just for testing the library):
for ($i=0; $i < 50000; $i++) {
$manufacturer->generatePaymentID($request);
}
I just tried generating and saving 50,000 hashids to my database as a test for my Laravel app and it doesn't seem that the padding parameter is being respected. I'm seeing plenty of IDs lower than requested, some consisting of just one digit, as well as a few hundred duplicates.
Here is the model code I used to generate the IDs, which passes a minimum length of 8 digits:
And here's the quick-and-dirty
for
loop I'm using to run the above function as part of my migration (as I said, just for testing the library):