有谁知道哪里有c#代码或dll可以生成样本信用卡号

时间:2022-09-23 08:04:24

For an application we are working on I need to generate sample credit card numbers which pass the Luhn algorithm but which are also unique, so we cannot use the sample credit card numbers.

对于我们正在开发的应用程序,我需要生成样本信用卡号,该号码通过Luhn算法,但也是唯一的,因此我们不能使用样本信用卡号。

We need to be able to generate around 300 card numbers at a time, and ideally i would be able to do this when generating my input data.

我们需要能够一次生成大约300个卡号,理想情况下,我可以在生成输入数据时执行此操作。

Many Thanks

5 个解决方案

#1


Create random numbers, then calculate the checksum number.

创建随机数,然后计算校验和数。

You can find more information at Wikipedia - Luhn, both details about the algorithm and links to different implementations.

您可以在Wikipedia - Luhn上找到更多信息,包括算法的详细信息和不同实现的链接。

#2


From what I see you just need to ensure that when running through the algorithm you get a result of 0 (mod 10). So you can pick any number of random digits (or sequential if you like) and just add one last digit which will ensure that the number is valid.

从我看到你只需要确保在运行算法时得到0(mod 10)的结果。因此,您可以选择任意数量的随机数字(如果您愿意,可以选择顺序),只需添加最后一位数字即可确保该数字有效。

#3


I took the code from Graham Kings site and ported it to c#, also emailing Graham a copy, you can find it here link text

我从Graham Kings网站上获取代码并将其移植到c#,同时通过电子邮件发送给Graham一份副本,你可以在这里找到它链接文本

#4


Do you need the credit card #'s to pass any other tests? i.e. should they look like valid VISA, MasterCard, or AMEX, etc.

你需要信用卡#s来通过任何其他测试吗?即它们看起来应该是有效的VISA,MasterCard还是AMEX等。

If so, you may want a resource like Graham King's otherwise some of the other suggestions here are good.

如果是这样,你可能想要一个像Graham King这样的资源,否则这里的其他一些建议都是好的。

The latest version of Graham King's generator (including c# code) can be found on GitHub.

最新版本的Graham King的生成器(包括c#代码)可以在GitHub上找到。

#5


If you need a list to test each card, you'll find one here. How to test credit card interactions?

如果你需要一个列表来测试每张卡,你可以在这里找到一张。如何测试信用卡互动?

#1


Create random numbers, then calculate the checksum number.

创建随机数,然后计算校验和数。

You can find more information at Wikipedia - Luhn, both details about the algorithm and links to different implementations.

您可以在Wikipedia - Luhn上找到更多信息,包括算法的详细信息和不同实现的链接。

#2


From what I see you just need to ensure that when running through the algorithm you get a result of 0 (mod 10). So you can pick any number of random digits (or sequential if you like) and just add one last digit which will ensure that the number is valid.

从我看到你只需要确保在运行算法时得到0(mod 10)的结果。因此,您可以选择任意数量的随机数字(如果您愿意,可以选择顺序),只需添加最后一位数字即可确保该数字有效。

#3


I took the code from Graham Kings site and ported it to c#, also emailing Graham a copy, you can find it here link text

我从Graham Kings网站上获取代码并将其移植到c#,同时通过电子邮件发送给Graham一份副本,你可以在这里找到它链接文本

#4


Do you need the credit card #'s to pass any other tests? i.e. should they look like valid VISA, MasterCard, or AMEX, etc.

你需要信用卡#s来通过任何其他测试吗?即它们看起来应该是有效的VISA,MasterCard还是AMEX等。

If so, you may want a resource like Graham King's otherwise some of the other suggestions here are good.

如果是这样,你可能想要一个像Graham King这样的资源,否则这里的其他一些建议都是好的。

The latest version of Graham King's generator (including c# code) can be found on GitHub.

最新版本的Graham King的生成器(包括c#代码)可以在GitHub上找到。

#5


If you need a list to test each card, you'll find one here. How to test credit card interactions?

如果你需要一个列表来测试每张卡,你可以在这里找到一张。如何测试信用卡互动?