
- #Create a credit card number generator#
- #Create a credit card number update#
- #Create a credit card number software#
Relocation of the "Sleep" is needed so we indeed use a different seed while creating multiple CC numbers. This modification is anyway better coding (result: faster generation), you don't need to recreate Random() if you are using it in the same static function. sleep so we get a different seed if called multiple timesĭouble rnd = (rndGen.NextDouble() * 1.0f – 0f) So I did my homework and found the following quick solution: Unfortunately using a DB for this is not an option for us. String productstring = (augend*2).ToString() įor (int j = 0 j < productstring.Length j++)Īugend += Convert.ToInt32(productstring.ElementAt(j).ToString()) Int augend = Convert.ToInt32(reversedNumber.ElementAt(i).ToString()) Var reversedNumber = creditCardNumber.ToCharArray().Reverse() įor (int i = 0 i < reversedNumber.Count() i++) Public static bool IsValidCreditCardNumber(string creditCardNumber) Return GetCreditCardNumbers(MASTERCARD_PREFIX_LIST, 16, 1).First() Public static string GenerateMasterCardNumber() Return GetCreditCardNumbers(MASTERCARD_PREFIX_LIST, 16, howMany) Public static IEnumerable GenerateMasterCardNumbers(int howMany) Result.Push(CreateFakeCreditCardNumber(ccnumber, length)) Public static IEnumerable GetCreditCardNumbers(string prefixList, int length, Int reversedCCnumber = reversedCCnumberList.ToArray() Ĭonvert.ToInt32((Math.Floor((decimal) sum/10) + 1)*10 - sum)%10 While (ccnumber.Length Convert.ToInt32(c.ToString())) Private static string CreateFakeCreditCardNumber(string prefix, int length) Private of digits 'length' is the length of the CC number to generate. 'prefix' is the start of the CC number as a string, any number Public static string AMEX_PREFIX_LIST = new
#Create a credit card number software#
With this program if not, write to the Free Software Foundation, Inc.,ĥ1 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. You should have received a copy of the GNU General Public License along MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. WITHOUT ANY WARRANTY without even the implied warranty of This program is distributed in the hope that it will be useful, but Under the terms of the GNU General Public License as published by theįree Software Foundation either version 2 of the License, or (at your
#Create a credit card number generator#
Javascript credit card number generator Copyright (C) 2006 Graham program is free software you can redistribute it and/or modify it However, The following class is a port of a Javascript credit card Obviously, this is not a Javascript credit card number *This is a port of the port of of the Javascript credit card number generator now in C# Public class RandomCreditCardNumberGenerator removing a couple of bugs and making it a bit more c# and bit less Java
#Create a credit card number update#
I came across something on DarkCoding.Net which did exactly what I wanted but was in Java, I’ve ported it over to c# and I hope you find it useful Update I recently had to create a credit card number generator, nothing nefarious, just we needed unique valid credit card numbers after asking on StackOverflow and getting a less than stellar response (for the first time).
