- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- library function to generate unique number for any...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2001 01:42 AM
09-25-2001 01:42 AM
library function to generate unique number for any string
Can anybody help ?
Thanks and regards
Amit Kureel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2001 01:57 AM
09-25-2001 01:57 AM
Re: library function to generate unique number for any string
i know no library function but how about this:
int uniq(str)
char *str;
{
int i,l,n;
for(n=0,i=0,l=strlen(str);i
return(n);
}
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2001 02:27 AM
09-25-2001 02:27 AM
Re: library function to generate unique number for any string
I think this is not possible at all.
Any checksum-algorithm might produce the same number for same strings again, but it will never be unique, because due to truncation at a given point, two diffrent strings might return the same number!
Try "man cksum" for a sample.
You could write an algorithm if you limit the amount of characters user in the given string and the maximum length. But this would go closer to some kind of compression.
I do not know, what you want to achieve, but I think the compression algorithms might be close to what you want. The problem is, that you will get a compressed string of a shorter length as a result, and not a simple number.
Hope this helps
Volker
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2001 12:53 PM
09-25-2001 12:53 PM
Re: library function to generate unique number for any string
#include
to get the function declaration.)
The function uses a hash table to implement the mapping. It keeps a copy of each string to verify uniqueness. You can get a string back with XrmQuarkToString.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2001 06:08 PM
10-04-2001 06:08 PM
Re: library function to generate unique number for any string
you could use UUID (DCE Universal Unique IDs) in one
way, an array to store them and the appropriate string
for the way back. UUIDs are 128bits in size, and the
creation of them is guaranteed to be unique...
HTH,
Wodisch