Advertisement

08.29.2007 at 10:45PM PDT, ID: 22796487
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

Hash function to have sequenced numbers look like "random".

Tags: function, hash
Hello experts,

In short:
How do we take sequenced unique id's to appear as random?
We now have _unique_ id's ABCD1234, ABCD1235, ABCD1236 etc, which should appear more random, without losing the unique-ness. We are thinking of implementing some sort of hash functionality.

More lengthy:
For our custom documentum object type we have a request to provide each custom object with an unique 8-character (a-z0-9) object name. Our current implementation takes 8 unique characters from the object_id generated by documentum, which guarantees uniqueness of the object_name within the docbase. (Which is ok with our client.)

The problem however is that the r_object_id's are more or less sequential, and the client requested to have it look more random.
One way we looked into, is to have a unique random object generated in the doPostCreate by obtaining a lock on a specific object, generate a unique id and test it against the objects in the docbase, then release the lock. We think that this doesn't perform well, as over 50 objects will be created by a single workflow method at each call. That would require a lot of checkin's/checkout's and dql queries.
Our alternative is to find a hash function which takes the current 8 character substring of the r_object_id, and have the sequential id's appear to be random.
In our current situation when we run the workflow method generating not that many objects, we get object names like:
800F43B5
800F43B6
800F43B8
800F43C1

What hash function can we use?

-r-
Start your free trial to view this solution
Question Stats
Zone: Programming
Question Asked By: Roonaan
Solution Provided By: ozo
Participating Experts: 2
Solution Grade: A
Views: 0
Translate:
Loading Advertisement...
08.29.2007 at 11:15PM PDT, ID: 19797807

Rank: Guru

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
08.29.2007 at 11:26PM PDT, ID: 19797844

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
08.29.2007 at 11:31PM PDT, ID: 19797861

Rank: Guru

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
08.29.2007 at 11:36PM PDT, ID: 19797874

Rank: Guru

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
08.29.2007 at 11:48PM PDT, ID: 19797925

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
08.30.2007 at 12:22AM PDT, ID: 19798036

Rank: Guru

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
08.30.2007 at 01:50AM PDT, ID: 19798348

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
08.30.2007 at 02:08AM PDT, ID: 19798447

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
08.30.2007 at 02:13AM PDT, ID: 19798473

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
08.30.2007 at 02:37AM PDT, ID: 19798577

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
08.30.2007 at 04:17AM PDT, ID: 19798941

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
08.30.2007 at 08:50AM PDT, ID: 19801314

Rank: Guru

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
08.30.2007 at 09:16AM PDT, ID: 19801547

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
08.30.2007 at 09:30AM PDT, ID: 19801676

Rank: Guru

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
08.31.2007 at 03:02PM PDT, ID: 19811663

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
09.01.2007 at 01:49AM PDT, ID: 19813102

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
09.01.2007 at 02:20AM PDT, ID: 19813172

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
Microsoft
  • Internet Protocols
  • Applications
  • Development
  • OS
  • Hardware
  • Windows Security
Apple
  • Operating Systems
  • Hardware
  • Programming
  • Networking
  • Software
Internet
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Spy / Ad Blockers
  • Web Browsers
  • New Net Users
  • Web Development
  • Chat / IM
  • Anti Spam
  • Web Servers
  • Anti-Virus
  • Email Clients
Gamers
  • Tips
  • Online / MMORPG
  • Puzzle
  • Emulators
  • Action / Adventure
  • Role Playing
  • Consoles
  • Game Programming
  • Strategy
  • Sports
  • Misc
  • Computer Games
Digital Living
  • Hardware
  • Automotive
  • New Net Users
  • New Users
  • Software
  • Digital Music
  • Gaming World
  • Home Security
  • Apple
  • Networking Hardware
Virus & Spyware
  • Vulnerabilities
  • IDS
  • Encryption
  • Anti-Virus
  • Operating Systems Security
  • Software Firewalls
  • WebApplications
  • Cell Phones
  • Operating Systems
  • Internet
  • Hardware Firewalls
Hardware
  • Displays / Monitors
  • Handhelds / PDAs
  • Components
  • Peripherals
  • Laptops/Notebooks
  • Servers
  • Misc
  • Apple
  • Embedded Hardware
  • Networking Hardware
  • Storage
  • Desktops
  • New Users
Software
  • System Utilities
  • Industry Specific
  • Network Management
  • Photos / Graphics
  • Page Layout
  • VMware
  • Misc
  • Web Development
  • OS
  • CYGWIN
  • Voice Recognition
  • Virtualization
  • Message Queue
  • Quality Assurance
  • Security
  • Firewalls
  • MultiMedia Applications
  • Development
  • Database
  • Office / Productivity
  • Business Management
  • OS/2 Apps
  • Server Software
  • Internet / Email
ITPro
  • OS
  • Storage
  • Encryption
  • Operating Systems Security
  • Apple Hardware
  • Laptops & Notebooks
  • Servers
  • Networking Hardware
  • Peripherals
  • Devices
  • Displays / Monitors
  • WebTrends / Stats
  • Search Engines
  • Firewalls
  • Web Computing
  • WebApplications
  • IDS
  • Vulnerabilities
  • Email Clients
  • File Sharing
  • Spy / Ad Blockers
  • Web Browsers
  • Web Servers
  • Networking
  • Anti-Virus
  • Consulting
  • Chat / IM
  • Anti Spam
Developer
  • Web Servers
  • Web Browsers
  • Game Programming
  • Dev Tools
  • Industry Specific
  • Office / Productivity
  • Database
  • CYGWIN
  • Web Development
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Programming
  • Content Management
  • Application Servers
  • Protocols
Storage
  • Removable Backup Media
  • Storage Technology
  • Servers
  • Grid
  • Remote Access
  • Backup / Restore
  • Misc
  • Hard Drives
OS
  • Miscellaneous
  • Security
  • Development
  • Linux
  • VMware
  • MainFrame OS
  • Unix
  • Apple
  • OS / 2
  • AS / 400
  • BeOS
  • Microsoft
  • VMS / OpenVMS
Database
  • Oracle
  • Miscellaneous
  • MySQL
  • Software
  • Sybase
  • Contact Management
  • PostgreSQL
  • Data Manipulation
  • Clarion
  • InterSystems Cache
  • Siebel
  • MUMPS
  • OLAP
  • SQLBase
  • SAS
  • GIS & GPS
  • 4GL
  • Berkeley DB
  • DB2
  • Informix
  • Interbase / Firebird
  • FoxPro
  • Reporting
  • LDAP
  • Filemaker Pro
  • MS SQL Server
  • dBase
  • MS Access
Security
  • Misc
  • Web Browsers
  • Software Firewalls
  • Operating Systems Security
  • File Sharing
  • Spy / Ad Blockers
  • Vulnerabilities
  • WebApplications
  • IDS
  • Anti-Virus
  • Encryption
  • Anti Spam
  • Email Clients
  • VPN
  • Chat / IM
Programming
  • Editors IDEs
  • Installation
  • Handhelds / PDAs
  • Multimedia Programming
  • System / Kernel
  • Automation
  • Algorithms
  • Game
  • Signal Processing
  • Project Management
  • Open Source
  • Database
  • Misc
  • Languages
  • Processor Platforms
  • Theory
Web Development
  • Scripting
  • Blogs
  • Web Servers
  • Software
  • Search Engines
  • Web Graphics
  • Web Services
  • Images
  • Internet Marketing
  • Images and Photos
  • Components
  • Document Imaging
  • Web Languages/Standards
  • Illustration
  • WebApplications
  • Fonts
  • WebTrends / Stats
  • Authoring
  • Digital Camera Software
  • Miscellaneous
Networking
  • Protocols
  • Apple Networking
  • Network Management
  • Message Queue
  • Application Servers
  • Content Management
  • File Servers
  • Email Servers
  • Misc
  • Java Editors & IDEs
  • Wireless
  • Networking Hardware
  • Backup / Restore
  • System Utilities
  • ISPs & Hosting
  • Web Servers
  • Storage Technology
  • Removable Backup Media
  • Servers
  • Web Computing
  • Broadband
  • Grid
  • OS / 2
  • Novell Netware
  • Unix Networking
  • Windows Networking
  • Security
  • Telecommunications
  • Operating Systems
  • Linux Networking
Other
  • Lounge
  • Business Travel
  • Community Support
  • New Net Users
  • Philosophy / Religion
  • Math / Science
  • Miscellaneous
  • URLs
  • Expert Lounge
  • Politics
  • Puzzles / Riddles
  • Automotive
Community Support
  • Suggestions
  • New to EE
  • New Topics
  • CleanUp
  • Announcements
  • General
  • Feedback
  • Input
  • EE Bugs
 
08.29.2007 at 11:15PM PDT, ID: 19797807

Rank: Guru

Do you want the result in a particular range?
An if you have an encryption function with the same range, you could encrypt a sequential id.
If you don't need much randomness, you might add a number relatively prime to 36^8 and take the result modulo 36^8
or multiply by a number coprime to 36^8+1
 
08.29.2007 at 11:26PM PDT, ID: 19797844
ozo,

The resulting unique id would  be exactly 8 characters wide and each character would be in the range of A-Z0-9 (uppercase only).
When multiplying and adding stuff, we found that the resulting id's where still close to each other because in binairy form there will often be only one or two bits different and calculations therefor will be in smiliar ranges.

Roonaan
 
08.29.2007 at 11:31PM PDT, ID: 19797861

Rank: Guru

Adding, say 17435418088047 and taking the result modulo 2821109907456 should result in several bits different.
 
08.29.2007 at 11:36PM PDT, ID: 19797874

Rank: Guru

Do you require that all 2821109907456 possible ids can be generated?
if you have a 40 bit encryption function, you can use it to generate 1099511627776  different ids
 
08.29.2007 at 11:48PM PDT, ID: 19797925
When you use 40b-encryption, wouldn't it cause longer than 8-character strings to be generated. If we then take a substring, we might have non-unique ids afterall, won't we?

(Thank you for thinking with me. I was pulling my hairs at it since the request came in yesterday)
 
08.30.2007 at 12:22AM PDT, ID: 19798036

Rank: Guru

2^40 bits is 1099511627776, which is less than 36^8 = 2821109907456
One easy way of encoding a 40 bits into 8 characters  in the range of A-Z0-9
could be to pick 32 of those symbols in which to encode 5 bits per character.
 
08.30.2007 at 01:50AM PDT, ID: 19798348

Rank: Genius

           final long MAX_RAND = 2821109907456L;
            
            String id = Long.toString((long)(Math.random() * MAX_RAND), 36);
 
08.30.2007 at 02:08AM PDT, ID: 19798447
CEHJ,

Generating random id's is not the problem. We however must be sure that they stay unique, have only A-Z0-9 and are not sequential. By just generating random id's we will be sure for a while that id's will not overlap, but the chance is still there if we don't validate it. For documentum this means that for each uniqid we generate ourself we should validate against the docbase. We can save this queries when basing our uniqueid on the provided object id.

-r-
 
08.30.2007 at 02:13AM PDT, ID: 19798473

Rank: Genius

Yes sorry - that was a little thoughtless. One of the problems you have is the shortness (8) of the string. Can you do anything about that?
 
08.30.2007 at 02:37AM PDT, ID: 19798577

Rank: Genius

The problem is that once you've ensured the appearance of randomness + uniqueness - easy with SHA512 - you're left with a long string, which, truncated, will detract from both
Assisted Solution
 
08.30.2007 at 04:17AM PDT, ID: 19798941
The problem is that the numbers will be required to be typed in by suppliers as filenames and are used in interfacing with other systems. We are currently trying to convince the client to leave the sequentiality and fix this "problem" by training the end users.
 
08.30.2007 at 08:50AM PDT, ID: 19801314

Rank: Guru

> the numbers will be required to be typed in by suppliers as filenames and are used in interfacing with other systems.
Does this mean that you would want to be able to detect when a number is mistyped?
If so, you may want to generate a pseuro-random 7 or 6 digit string and add 1 or 2 check digits.

It is easy to find lots of literature on the subject of generating pseudo-random sequences
Assisted Solution
 
08.30.2007 at 09:16AM PDT, ID: 19801547

Rank: Genius

>>By just generating random id's we will be sure for a while that id's will not overlap, but the chance is still there if we don't validate it.

Those ids are going to have to be stored somewhere so you *can* check uniqueness
 
08.30.2007 at 09:30AM PDT, ID: 19801676

Rank: Guru

>>By just generating random id's we will be sure for a while that id's will not overlap, but the chance is still there if we don't validate it.
If you generate 41 bit pseudo-random sequences with a full period , it would not overlap before generating 2199023255552 unique ids
To validate, you would only need to remember where you started the sequence and how far you've gotten so you can tell when you've come around again
Accepted Solution
 
08.31.2007 at 03:02PM PDT, ID: 19811663

Rank: Genius

If you're interested, i've got a file with 5 million unique 8-character ids
Assisted Solution
 
09.01.2007 at 01:49AM PDT, ID: 19813102
Hi CEHJ,

That would be very helpfull. At this stage however we are advising the client to just go with the sequential numbering, as the performance impacts of alternative solutions seem te severe.

I will accept your answers as the are all good in similar situations, although I will probably not use them in ours.

Kind regards

-r-
 
09.01.2007 at 02:20AM PDT, ID: 19813172

Rank: Genius

:-)

OK - let me know later if you want
 
 
20080716-EE-VQP-33 / EE_QW_1_20070628