How to generate a simple registration code,based on input given by the user and verifying it after installation

筅森魡賤 提交于 2019-12-13 06:44:19

问题


Suppose, I have created an android mobile application.

What I am looking for is, once the user purchases my application from my website, he will input his IMEI number.

I want to generate a simple registration code, which can be emailed to him after purchase is successful.

The user will then enter the code in the application, application will internally fetch the IMEI number and validate the registration code.

How can I generate such registration code?

Are there algorithms/ tools available which can help me do this?

Thanks, Aseem Chiplonkar


回答1:


Depending on what you are going to be developing your site in, you may want to take a look into GUID's or something of that sort...Read more Here




回答2:


What you can do is once you have received the IMEI from the user you can apply an algorithm on it (you can, for example, shuffle the string and add some salt on it) and them generate a hash of it.

Send this hash do the user and when he/she types this hash on you app you will fetch the IMEI , apply the same algorithm and calculate the hash. If the hash matches the one you sent them your app will be activated.

I would use Sha256, but you can also use any other hash function you like.

You can also apply a Base64 algorithm to the hash to make it easier to type.



来源:https://stackoverflow.com/questions/4468059/how-to-generate-a-simple-registration-code-based-on-input-given-by-the-user-and

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!