Exetools  

Go Back   Exetools > General > General Discussion

Notices

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 01-14-2020, 04:36
chants chants is offline
VIP
 
Join Date: Jul 2016
Posts: 826
Rept. Given: 47
Rept. Rcvd 50 Times in 31 Posts
Thanks Given: 737
Thanks Rcvd at 1,140 Times in 529 Posts
chants Reputation: 51
My formula used bit wise and &, equality comparison ==, implicit cast of true/false to 1/0 and integer multiplication *, and integer addition +. It should work in C or Javascript or what have you. x is the input, the result is the output. Exactly as you specify it.

This works since the last digits are all unique. By bitwise and with 0xf, we get the last digit of the input and compare with each unique last digit. If equal it will result in 1 times the correct output value otherwise 0. Then summed all together maps them properly.

Any one to one mapping can be done without the bitwise and, using only the other 4 operations. Of course it will only work for individual inputs then and will always be zero for not yet seen numbers. Currently it works for individual input last digits that match and is 0 for all other inputs.

Last edited by chants; 01-14-2020 at 04:44.
Reply With Quote
The Following User Says Thank You to chants For This Useful Post:
mcr4ck (01-14-2020)
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Find the Algorithm mcr4ck General Discussion 3 05-26-2020 18:19
Is this RSA algorithm? bridgeic General Discussion 30 08-09-2014 23:48
Did anyone try to find the SLM 7.2 dongle ComputerID Query Algorithm? RegUser_2 General Discussion 2 04-27-2004 12:49


All times are GMT +8. The time now is 03:06.


Always Your Best Friend: Aaron, JMI, ahmadmansoor, ZeNiX, chessgod101
( Since 1998 )