473,396 Members | 1,809 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Pin Algorithm

Hi,

I want to work out an a short algorithm to generation pin number (max: 6
digits) based on unique ID (48 bits)
Let say the ID entered is 000000FB2C3A
which is 0x00, 0x00, 0x00, 0xFB, 0x2C, 0x3A.

Any good algorithm?

Thanks.

Nov 14 '05 #1
7 4238
In 'comp.lang.c', "Magix" <ma***@asia.com> wrote:
I want to work out an a short algorithm to generation pin number <...>


How is this a C-language question? It's a design issue.

--
-ed- get my email here: http://marreduspam.com/ad672570
The C-language FAQ: http://www.eskimo.com/~scs/C-faq/top.html
C-reference: http://www.dinkumware.com/manuals/reader.aspx?lib=c99
FAQ de f.c.l.c : http://www.isty-info.uvsq.fr/~rumeau/fclc/
Nov 14 '05 #2
kal
"Magix" <ma***@asia.com> wrote in message news:<40**********@news.tm.net.my>...
I want to work out an a short algorithm to generation pin number (max: 6
digits) based on unique ID (48 bits)
Let say the ID entered is 000000FB2C3A
which is 0x00, 0x00, 0x00, 0xFB, 0x2C, 0x3A.

Any good algorithm?


#define PIN (000052)
Nov 14 '05 #3
Magix said the following, on 07/16/04 05:29:
Hi,

I want to work out an a short algorithm to generation pin number (max: 6
digits) based on unique ID (48 bits)
Let say the ID entered is 000000FB2C3A
which is 0x00, 0x00, 0x00, 0xFB, 0x2C, 0x3A.

Any good algorithm?


What is your question about C ?

[OT]
You have asked for a "good algorithm", without giving us any idea of
what "good" means in the context of your problem. So I will define
"good" as quick and simple, and suggest that you write a function like this:

/* uid points to the unique ID string */
/* the 'genpin' function returns the PIN */
int genpin (char *uid )
{
return 42;
}

If, as the term PIN suggests, you are thinking of this as some sort of
security function, then generating the PIN by some algorithm from the
"unique ID" is a Very Bad Idea. Once anyone figures out your algorithm,
ALL your IDs are toast.

--
Rich Gibbs
rg****@alumni.princeton.edu

Nov 14 '05 #4
In 'comp.lang.c', k_*****@yahoo.com (kal) wrote:
"Magix" <ma***@asia.com> wrote in message
news:<40**********@news.tm.net.my>...
I want to work out an a short algorithm to generation pin number (max:
6 digits) based on unique ID (48 bits)
Let say the ID entered is 000000FB2C3A
which is 0x00, 0x00, 0x00, 0xFB, 0x2C, 0x3A.

Any good algorithm?


#define PIN (000052)


ITYM

#define PIN 42

--
-ed- get my email here: http://marreduspam.com/ad672570
The C-language FAQ: http://www.eskimo.com/~scs/C-faq/top.html
C-reference: http://www.dinkumware.com/manuals/reader.aspx?lib=c99
FAQ de f.c.l.c : http://www.isty-info.uvsq.fr/~rumeau/fclc/
Nov 14 '05 #5
>I want to work out an a short algorithm to generation pin number (max: 6
digits) based on unique ID (48 bits)
Let say the ID entered is 000000FB2C3A
which is 0x00, 0x00, 0x00, 0xFB, 0x2C, 0x3A.

Any good algorithm?


Populate a database with all in-use IDs and the corresponding PIN.
(Use true-random number generation to do this, which means that you
DO NOT depend on rand() or any other kind of pseudo-random number
generator. Consider rolling actual dice. Or let each user select
their own.)

Using an algorithm to generate a PIN number, which is used for
security purposes, is a problem. If someone figures out the
algorithm, *ALL* of the PINs are compromised. This is a problem
even with relatively decent cryptographic hashes like MD5. (MD5
used to generate PINs from IDs will make it hard to figure out the
ID from the PIN, but it won't help in figuring out the PIN from the
ID.)

Look up the PIN corresponding to the ID and check if it matches.

Gordon L. Burditt
Nov 14 '05 #6
Emmanuel Delahaye <em**********@noos.fr> scribbled the following:
In 'comp.lang.c', k_*****@yahoo.com (kal) wrote:
"Magix" <ma***@asia.com> wrote in message
news:<40**********@news.tm.net.my>...
I want to work out an a short algorithm to generation pin number (max:
6 digits) based on unique ID (48 bits)
Let say the ID entered is 000000FB2C3A
which is 0x00, 0x00, 0x00, 0xFB, 0x2C, 0x3A.

Any good algorithm?
#define PIN (000052)

ITYM #define PIN 42


Why? (000052) and 42 are the same number in C.

--
/-- Joona Palaste (pa*****@cc.helsinki.fi) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"To doo bee doo bee doo."
- Frank Sinatra
Nov 14 '05 #7
Rich Gibbs <rg****@REMOVEalumni.CAPSprinceton.edu> writes:
If, as the term PIN suggests, you are thinking of this as some sort of
security function, then generating the PIN by some algorithm from the
"unique ID" is a Very Bad Idea. Once anyone figures out your
algorithm, ALL your IDs are toast.


You can make it difficult to figure out the algorithm, e.g. by
using a secure cipher or keyed hash function. But this is a
better topic for sci.crypt.
--
"In My Egotistical Opinion, most people's C programs should be indented six
feet downward and covered with dirt." -- Blair P. Houghton
Nov 14 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Jack Smith | last post by:
Hello, any help appreciated with following problem. I figured out the algorithm (I think), just having trouble proving it is optimal. Suppose we are given n tasks each of which takes 1 unit...
10
by: bpontius | last post by:
The GES Algorithm A Surprisingly Simple Algorithm for Parallel Pattern Matching "Partially because the best algorithms presented in the literature are difficult to understand and to implement,...
32
by: Cmorriskuerten | last post by:
HI, is this is this solution to test if a number is a prime number or not: /* * Is n a prime number? * Return TRUE (1): n is a prime number * Return FALSE (0): n is a *not* a prime number...
113
by: Bonj | last post by:
I was in need of an encryption algorithm to the following requirements: 1) Must be capable of encrypting strings to a byte array, and decyrpting back again to the same string 2) Must have the same...
4
by: FBM | last post by:
Hi, I am working on a program that simulates one of the elements of ATM. The simulation stores events which occurs every some milliseconds for a certain amount of time. Every time that an event...
2
by: Julio C. Hernandez Castro | last post by:
Dear all, We have just developped a new block cipher called Raiden, following a Feistel Network structure by means of genetic programming. Our intention now consists on getting as much feedback...
0
by: aruna | last post by:
hey guys i earlier had very valuable responses from you all for base64 encoding algorithm.so thank for that. so now i need your assistance to do a float encoding algorithm. you may wonder why i'm...
1
by: almurph | last post by:
Hi everyone, Concerning the Needleman-Wunsch algorithm (cf. http://en.wikipedia.org/wiki/Needleman-Wunsch_algorithm) I have noticed a possible loop. Inside the algorithm there is an...
9
Rabbit
by: Rabbit | last post by:
Introduction The Advanced Encryption Standard is the algorithm that won the National Insitute of Standards and Technology's (NIST) search for a standardized encryption algorithm in 2001. In 2002, it...
24
Rabbit
by: Rabbit | last post by:
INTRODUCTION The Secure Hash Algorithm 2 is a series of cryptographic hash algorithms designed by the US National Security Agency (NSA) and published by the National Institute of Standards and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.