Creating the shortest possible case-insensitive ve

2019-06-13 20:36发布

This is going to be a little long and rambly, but I want to make sure everything is in the proper context.

Back in 2004 I wrote an online Learning Management System using Classic ASP and VBScript. I'm now working on some upgrades (and periodically asking myself WTF I was thinking when I wrote various segments of code...), and I want to take this opportunity to resolve one of the frequent complaints I get - the size of the verification numbers.

When you complete a test online, a verification number is displayed so if you needed to re-create your certificate of completion (its a hospital, and trying to get them to get rid of their paper is like asking Linus to give up his blanket) you can enter the number, etc. etc.

At the time I wrote it (and sadly still to this day) there is no unique identifier I can use to create a transcript page - so please don't post suggestions to that end. There's more going on than I care to get into, and I want to head off valid suggestions that I can't use. ;)

The verification number is a concatenation of various pieces of information (mostly because when I first wrote it I was an idiot newb and SO wasn't around), and while it is a much-appreciated feature there are a lot of complaints about how long the number is. Returning the raw ID at this point is no better as we're in the 6-digit range.

My initial idea was to use a Base64 encoding algorithm I got from elsewhere, but given the problems I've had with just numbers, I'm thinking changing it to a case-sensitive value is only asking for a different class of problems... which brings me to the question at hand:

What can I use to create the shortest possible case-insensitive verification number since hex won't reduce the length appreciably?

And as the tags indicate, I need to be able to implement it in ASP Classic/VBScript - migration is not an option at this point.

Edit: based on the answers, I found a link to Crockfor's implementation of Base32, which looks like what I'm looking for - http://www.crockford.com/wrmg/base32.html

3条回答
家丑人穷心不美
2楼-- · 2019-06-13 20:50

case insensitive letters and numbers? you need a base (26 + 10) converter I think...

查看更多
一夜七次
3楼-- · 2019-06-13 20:53

How about using Huffman Coding on a binary representation of the concatenation of the information in the certificate? Then return the result as a decimal number.

查看更多
爷的心禁止访问
4楼-- · 2019-06-13 21:09

Base36?

Edit: As Lucky mentions in the comments, using Base36 probably doesn't give any real advantage over Base32 in this situation.

查看更多
登录 后发表回答