Following from the discussion here (http://www.masm32.com/board/index.php?topic=9370.msg84909#msg84909 onwards) about ways to improve the lab and testing in general, i thought id categorize the first 10 pages of the lab to see how it might look if we had this in place. I may have missed a few posts, but generally the idea is to show how it could be made to look a bit more ordered. Some posts would fit into multiple categories of course, but what im showing is merely the basis of the idea or as a summary thread (ofc with post links attached if implemented). There could be many other categories and/or some of the below could be renamed, i'm sure you get the general idea.
Laboratory Categories:
- CPU, Code Execution & Code Timing
Code timing macros
Timings and cache
Timings macro
Quick CPU info based on CPUID
Timings for AMD, P4, Core Duo
Updated Intel' s Manuals (DR AGNER FOG' s comments would be highly appreciated)
Code sizing macros
Macros and assembly speed
Calling bios from XP 64 driver
Branchless Conditional Code
An idea for realtime profiling
- Strings & string seaching
InstrCi - case-insensitive string search
Golden oldie BM algos written by Jeremy Collake
String searching
szLen optimize...
lstrcpy vs szCopy
IsBadReadPtr and strcopy routines
Working with unicode string data
safe_strlen,safe_strcpy
Best way to convert hexadecimal coded string to binary string?
Unicode string length
Print Multi String Zero
Follow on from Levenshtein - Soundex
Improved CAT$ macro
Basic emulation space$() macro.
strstr rewrite / core 2 6400 issue
Strange result with my StrCat function... Why ?
szLeft and szRight
Optimized UNICODE Conversion
extended print macro
- Memory, Arrays & Sorting
memcpy using the stack pointer register.
LUT Optimization
Idea for multithread memfill
Fixed array test piece
Dynamic string array benchmark
Linked-List, Stack by x86 Assembly
Test piece using the SafeArray system for a dynamic array.
Dynamic string array
Multithread mem fill try 2
Dynamic array library, examples and benchmark
ZeroMemory with SSE2
Merge Sort
ZeroMemory Speed Test!
Memory faster than register - subtle optimization issue?
protosort
- Base Conversion (Hex, Dec, Binary)
Converting a decimal number to ascci (dwtoa)
Binary to Decimal using multiply
Float to string without fpu
qwtoa using xmm registers?
decimal as KiB,Mib,GiB etc.
dwtoa
Optimizing dw2hex_ex
Bin$
Faster Bin2ASCII
masm.lib functions dw2ah and a2dw
- Maths & FPU
Adding up fractions with FPU
Fast SSE floor() function
float$ macro and algo for testing
MOVED: Finding Greatest Common Divisor (GCD)
Fast SSE Ceil() Function
UNSIGNED Integer square root problem
Simple multiply algorithm.
Fpu in C++
Fibonacci Series
Double check my floating point logic
Odd or Even
Changeing Radix
Integer square root
Factorial Program
Dear Math and FPU-Experts - help needed!
Strange FPU Command? Undocumented?
Arbitrary-size integer addition
Fast SSE truncate function
Is Negative
Assembly-time random number generator
Float-to-half conversion
64bit addition
MODx and DIVx macros
Integer vs FPU square root
Sine in SSE2 vs. FSIN
Fast Floating-Point to Integer Truncation
Simply FPU 1.4 (Chm Format)
- Crypt/Decrypt, Code/Encode & Hashing
Encryption DLL
TEA (Tiny Encryption Algorithm) ASM Implementation
Optimised MD5 File Checksum Routine
MOVED: reverse CRC32
Bitslice MD5
- Date & Time
CCYYMMDD dword to Julian date conversion
Day Of The Week Algo
Faster FileTimeToSystemTime
Bin2Time, Converts binary value to hours:min:sec.000
Average milliseconds per character to Words Per Minute
- Graphics
Graphics
Alpha blending
Graphics again.
Break & Bash - 3ds Model Loader
3D Vector Normalize with SSE2
3D_Core
sDraw speed test in Vista
Line function
2D collision detection
PutPixel Function
Blending pixel function
Directx drawtext
Matrix and vector operations using FPU
bitmaps scrolling
- Files, File Formats & Parsing
Text File handler
Comma Seperated File (CSV) Component Extraction
XML Genius requred
floppy IMG file backup.
Doc Comment Parsing
Command Line Parser
XML Component (objasm32 version)
XML Writer-Parser Source Code
Looks convincing. There are a few items that do not fall under the category "speed", e.g. date & time, XML, and imho they could be moved to the Workshop. But let's hear the others :bg
looks good fearless
i think an important thing is to get a feel for which instructions/sequences act very differently from one cpu to the next
for algos that behave more or less the same from one cpu to the next, it is a matter for optimizers
one of our goals should be to pick up where optimizers leave off
that is to make a reference for programmers who want to pick an algo that will
provide the best overall performance on a variety of cpu's,
as opposed to picking the one that performs best on their own machine
hmm, it could boost posts, but it could also reduce them (i remember some changes on another forum...).
now, if it can avoid speed tests with string/stringci/bm search algos in the same test... :bdg
well - we need a wide variety of algos run on a wide variety of cpu's
i think it will be fun for everyone except the ones who have to collect and organize the data in presentable form
i also think it will be a good way to learn and share tips and tricks
along the way, we all get to write code that performs better on different machines
it would provide a service for members and non-members alike, one that has no equal anywhere
hmmmm,
Hold your breath waiting. Seriously, additional fragmentation does not help, it just becomes another hinderance to finding and perhaps participating in technical threads. The "per topic" system works fine so if you have a topic "blitters" then any interested parties can post their variations of bit blit routines, same with string length algos, text formatters, parsers etc .... The range of possible categories for the LAB is almost infinite so I don't see the point of trying to pre-emp what will get posted in the future.
Good point Hutch. KISS.
Regards,
Steve N.
perhaps we can still make the reference without changing the way it is posted
we just have to be smarter about collecting information
we can at least suggest they keep timing tests in the Laboratory
that will localize it for us
hmmm,
Is there a commiitee? Did not know that. There are s-o-o-o many things that would have to be categorized that it would be impossible to do, let alone maintain. There is already a SEARCH feature which allows a user to search for algos (there is no gaurantee that they will even be in the Lab). That is what I do. Even if you do not know the name of the algo, you can do a general search pertaining to the algo.
Also, there would absolutely be NO way to police it to make sure it is used properly and many will have differing ideas of where a particular algo would/should be placed in the first place.
Huitch, perhaps you should post more often because it is evident that people think you are bored. :bdg
Paul
The structure and the planning of the Masm Forum is OK. There is no need to modify it. An exception can be that a new assembler is introduced to the community.
well, we (fearless, Jochen, and I) were talking about trying to organize the information
i don't think we need to modify the forum or make a committee, for that matter
the goal was to simply get algos run on a variety of different CPU's
the way it is, only those who are interested in a particular algo bother to look at the thread or run the test and post results
what is missing from that formula are the other CPUs (those that un-interested parties may have that the interested ones do)
let me give an example:
i have an algo i would like tested - say an array multiply
i have a few different versions of the algo that do the same thing
i create a thread and post the code
those who are interested in "array multiplication" look at and perhaps run the test
in this case, that may be 3 or 4 people (or even less - lol)
we only get to test the algo(s) on 3 or 4 machines - some of which may have the same CPU
it is hard to ascertain which algo method has "best overall performance" from such a limited pool
when, in fact, we have a nice assortment of CPU's available in the membership
not everyone is likely to be interested in array multiplication (i know i am not)
dedndave,
I see your point but any organization made is not likelly to stimulate additional postings. Personally, I am not in favor of restrictive algos at all. Algos should run on all machines. CPUID, for instance, is something I would never code into an algo. It can be very frustrating for a person to have something that works and then when they buy another computer it stops working. What happens next is we get vague postings that require effort to locate the problem. It is just a poor habit IMO. It is bad enough that no matter what is done in terms of optimizations, the results tend to be CPU specific. That is why I am not a fan of optimization. Given the fact that we have so much memory and space available on today's machines, it is no longer necessary except for certain time critical applications anyway.
Paul
Paul
thanks for your input Paul
you never use CPUID ?
it has been supported since 486's
and - there is a way to see if the processor supports it prior to using it
if it is not supported, the programmer must find alternate methods of IDing the cpu
it struck me as odd because i just happen to be writing a program that uses CPUID - lol
but - that means that mmx and sse are out because they are not supported
myself, i try to stay under sse3 because there are so many processors still active that do not support it
of course, if a programmer wanted to get real busy, he/she could write a different routine for each level of support
like you say - that had better be a speed-critical part of the program to warrant all that effort
btw - what processor do you have that does not support CPUID ?
inquisitive minds need to know
:bg
Paul,
> Huitch, perhaps you should post more often because it is evident that people think you are bored. :bdg
That is the case from time to time but it has nothing to do with programming or this forum, its more from having too much to do and at times not wanting to do it all. I have just about finished the second stage of a complicated foundation in the kichen of my house, then there is the floor design where I have to fund the material then when thats finished I have to cut out and weld a few bits on my car to get it registered next time etc etc ....
Add this to the normal daily tracking of the forum, spam and member join maintainance and you will see that I actually get a lot done daily.
Hutch,
I have a tendency to follow some of your alternate projects as many are interesting to me so I am well aware that no moss grows on your butt. I remember a project you were working on years ago which was the way I first met you as you needed help with some time intensive tasks. I have written a pretty kewl proggie that is used to examine stuff of that sort with exports, saves, etc. All parts of the data have been modulized into a DLL, etc. Just wanted to know if you still have an interest in that area. I can send you the sources if you are.
dedndave,
All my systems support CPUID. The thing is, though, I never program around what my systems can and cannot do. I program around the systems that may be used by people wanting to use my apps or learn from my sources. You need to expand your horizons if you wish to program for the community. Keep plugging away, though, you will eventually see my point.
Paul
oh - i understand quite well Paul
i agree, also
you are talking to "Mr Oldversion" - lol
i still use IE 6 and Firefox 1.5.0.12 - because they are fast and light (well, IE was never fast or light)
but, cpuid is supported all the way back to later 486's
at some point, an instruction or function call has to become usable
cpuid is used extensively in all our timing routines that evaluate code (algorithms/instruction sequences)
we would be unable to do so without the instruction
if we never updated, we'd all be writing code that looks like this...
WrMsg PROC NEAR
CLD
WrMsg0: LODSB
OR AL,AL
JZ WrMsg1
MOV BH,0
MOV CX,1
MOV AH,0Ah
PUSH SI
INT 10h
POP SI
JMP WrMsg0
WrMsg1: RET
WrMsg ENDP
(http://www.winasm.net/forum/uploads/post-9-1205944070.jpg)
Ahaha, I want that supercoder :green2 :green2 :green2 :green2
I had a gal like that, once
The way CPUID works using an INTEL CPU (no matter what version) is consistant. However not all CPU manufacturers use all the options supported by the INTEL CPUs. Wikipedia explains this, perhaps you were unaware of this? I am not in the habit, as many know, of speaking just to hear myself talk. If I make a statement such as this, it is in your best interest to investigate if you truly want your programs to run on all machines which is a hallmark of my type of programming.
Jokes at my expense are amusing, yet disappointing.
Paul
no Paul - the joke was not meant to offend you in any way
i appologize if it did
actually, i was hoping you'd get a chuckle out of the keyboard
the way cpuid is used in our timing routines is to merely serialize reads from the TSC counter
for that use, we do not care what the returned values are
some programs also use it to identify the processor type
this is a whole different bag of worms
if a programmer is going to use it that way, he has to read and incorporate the information
from all the cpu manufacturers - Intel - AMD - Cyrix - and so on
certainly, if the program is unable to ID the cpu that way, it should at least
report "CPU Unknown" and continue functioning to evaluate code/algos
Quote from: dedndave on May 25, 2009, 02:24:45 AM
some programs also use it to identify the processor type this is a whole different bag of worms. if a programmer is going to use it that way, he has to read and incorporate the information from all the cpu manufacturers - Intel - AMD - Cyrix - and so on certainly, if the program is unable to ID the cpu that way, it should at least report "CPU Unknown" and continue functioning to evaluate code/algos
Very well said and I am not offended. I think you try to be very helpful to all which is why I took the time to explain that some instructions can be problematic.
On a different note, I am writing an XOR encryption algorythm for Sudoku to prevent the user database from being easily modified via a text editor. I need to, also, add a checksum algo and I am not sure howto approach this. Do you have any ideas? I already have the encryptor, just have not got much experience with checksums.
Paul
Quote from: dedndave on May 17, 2009, 05:10:04 PM
the goal was to simply get algos run on a variety of different CPU's
the way it is, only those who are interested in a particular algo bother to look at the thread or run the test and post results
what is missing from that formula are the other CPUs (those that un-interested parties may have that the interested ones do)
Had an idea for this, its a rather complicated idea to implement but worth throwing out to see what people think.
Have a MySQL database with registered users that are willing to take part in algo testing. An algo is submitted via a php page that is formatted in a particular way. A client app is ran and a balloon tooltip pops up when a new algo is submitted that a user might like to test. The algo is downloaded via the sql server to a local file, compiled and ran (automagically?), the results are posted back to the server. The submitter and others can see a list of clients that have processed the algo, times, cycles etc and cpu information in a php page for their submitted algo - an algo report if you like. This project could be called something like AlgoLab or whatever.
Requirements & thoughts:
- Website with MySQL and php
- Coding for website for the php pages for reports, algo submissions etc, listing of algos, forum for discussion
- Security for posting algos - limited to specific people? open to all?
- Client app shows a list of queued algo submissions to test, also balloon tip on new algo posted
- Client app runs interactively so user can see code before running? or like folding@home when pc is not busy? (security issues here as who wants code ran without checking what is ran)
Lots of work involved and lots of considerations to take into account. Could be a nice project for someone or a group of people to do.
Anyhows it just an idea, might be more hassle than its worth, but perhaps there is a beginning of an idea here...
I've thought about something like this also. A "community testbed application" or similar. Problem is, what happens if one malicious user submits a "sorting algorithm" code which really empties the user's registry? (For instance.) Everyone who has the application would immediately be affected.
that sounds good - i was thinking of something along that line
i didn't know where to begin to implement it, however
a simple site - grab something that seems interesting to you - run it - upload the results into a data-base
i suppose the test software could do the upload for them
on the flip-side, they could see results run on other machines - i.e. view the data-base
and, submit code for proposed tests
once it is set up, the only real human interaction would be to preview
the submitted code in order to prevent malicious code execution
I agree Mark, that would be one of the big problems to overcome.
My first thought that a submission might only me made by persons of certain rank (moderator, user with x posts etc), but this means the entire process is restrictive.
One could argue that the current process of viewing topic thread, seeing an authors name (and "trusting" them) and then downloading their attached exe to run has that trust issue as well. Perhaps a moderator or moderators can review a submission and approve it, which means it is then marked for downloading to a client machine when the cleint app polls the server. A listview dialog pops up with list of algos, author name, summary of algo, presented to user. Listiview dialog shown when user clicks on tray icon or the balloon new algo tooltip is shown. User makes selection to run test (which removes it from listview)
fearless,
It is a great idea and like all great ideas; if it is great enough; answers to these problems will be worked out - one at a time. Why not test all algos using SandBoxie, for example.
It will take some thought, some work and we would need to find the web resouces needed. Souns like fun. For years 'Fun' was my job description.
Paul
Quote from: PBrennick on May 28, 2009, 12:22:18 AM
On a different note, I am writing an XOR encryption algorythm for Sudoku to prevent the user database from being easily modified via a text editor. I need to, also, add a checksum algo and I am not sure howto approach this. Do you have any ideas? I already have the encryptor, just have not got much experience with checksums.
Hello,
Checksums are pretty simple. The idea is you have a block of data
that you want to check for errors. You add up all the elements in the
block, and that sum gives you a value to check for changes. A variation
is you add up everything to get your checksum, negate that, and append
it to the end of the data. That way summing over all the plus the added
checksum gives you a zero.
Part of the EXE header specifies a checksum value, as shown here:
Program to display file checksums and CRC codes. Ver 3.
File Date Time Size Checksum CRC-32
CIRCL256.EXE 27 May 09 9:31 1057 65535 4BF5C1D3
DISTRIB6.EXE 27 Sep 07 12:47 37227 65535 770A108E
DISTRIBD.EXE 25 Oct 07 12:53 38115 65535 E2F33E5F
HEAP16.EXE 24 Oct 07 13:23 38151 65535 D823CD8B
HEAP26.EXE 24 Oct 07 13:24 38151 65535 34F02EB9
HEAP2D.EXE 24 Oct 07 16:27 38154 65535 DAFE9DB6
HEAP46.EXE 24 Oct 07 13:13 38151 65535 EB3ACDB5
HEAP56.EXE 24 Oct 07 13:14 38151 65535 78F970F9
TIMEIT.EXE 26 Sep 07 15:14 1495 65535 1BFC1944 As shown, you don't need to make things sum to zero.
Obviously, it is a simple check and not very robust, so more
complicated error checks were created, such as CRC's. But they
are a good first cut to check for errors or tampering. Either
attach the negated checksum to the end of your data block,
or create a separate table of checksums for each of your data
blocks. Once you get that working to your satisfaction, you
can determine if it is worth while to upgrade the protection
to a CRC or other error correction code.
HTH,
Steve N.
Thanx, I have written the code for the checksum and am now working on a basic encryptor to add a further level of protection. So the process is:
1. Create a checksum
2. Encrypt the data
3. Hex Encode the data to ensure so it will display on one liine.
It is all going to be very simple but necessary as I have already received emails about people tamering with the data in the INI file and then reporting an error in the program; it got old real quick. This would be very easy to crack but will serve my purposes quite well as the checksums will be stored elsewhere also.
Paul
interesting that the EXE checksums are all 65535
the old DOS headers had a word-sized location to bias the checksum so that EXE's always came out to 0
Hi dedndave,
Well. Could be a bug (old code). I'll look into it. The MS-DOS
Reference seems to agree with you if I read it correctly. It says
the field is foe a ones complement of the checksum. And 0FFFFH
ends up as a negative zero. But normally you would end up with
a normal zero.
Hmm,
Hi Paul,
Instead of hex, I would use a base 85 encoding. A bit more
challenging for the tamperers, especially if you use a custom
encoding. Just a thought.
Best regards,
Steve N.
(pssst FFFF is -1 shhhhhhh)
negative zero is someone who washes out of a police academy
Quote from: dedndave on May 29, 2009, 09:27:32 PM
(pssst FFFF is -1 shhhhhhh)
negative zero is someone who washes out of a police academy
2's complement 0FFFFH = -1
1's complement 0FFFFH = -0
Loads of fun. Reminds me of the old CDC Cyber days.
Anyway checking the code showed no bug. In typical M$
speak, "ones complement (inverse)" is a bitwise not. Any
value added to its bitwise not/complement/inverse will have all
its bits set.
Cheers,
Steve N.
ahhhh - missed that one - lol
glad it wasn't on a test or something
i don't know of any OS that actually checks that value
i have modified plenty of EXE's without diddling the checksum
Quote from: dedndave on May 29, 2009, 09:27:32 PM
(pssst FFFF is -1 shhhhhhh)
negative zero is someone who washes out of a police academy
include \masm32\include\masm32rt.inc
.code
start: int 3 ; let Olly show you what a negative zero is ;-)
push -1
fild dword ptr [esp]
push 0
fild dword ptr [esp]
fdiv st, st(1) ; THERE IT IS!
pop eax
pop eax
exit
end start
:bg
Hi,
Well, the EXE's coming out now don't even follow that rule anymore.
So there would not be any reason to test it!
DELTTSUL.EXE 26 Jul 00 7:00 5392 18439 AB019F8A
DISCOVER.EXE 26 Jul 00 7:00 41744 53791 8F489C29
DRIVER~1 14 Dec 00 6:04 <DIR>
EXPLORER.EXE 19 Jun 03 14:05 243e3 16025 DA96361B
Steve N.
oh - i knew they had em in float world - lol - hundreds of em, actually (some of em may be NANs - i dunno)
they also have a half-dozen opposing theories on how to handle infinity all on the same chip ! - lol
on some of the EXE's ive looked at lately, that field is 0 (positive 0)
Steve,
Okay, so now I feel stupid. Don't know about Base 85 and would like to know. Do you have an algo. By the way, the purpose of the hex encoding is because the output from the xor encryptor can have control values which would or could cause the 81 byte stream to become mult-lined. The hex encoding fixes that.
P
Paul,
http://en.wikipedia.org/wiki/Ascii85
wow - i didn't know they tried to make data bigger
i used the opposite technique a few times.........
Base 65
first, i carefully selected 65 ASCII characters for the text file (it was a config/help file)
that gives you 0-9, a-z, A-Z, space, carriage return, line feed
i had to remove a few capital letters to allow for punctuation characters - i just won't start any sentances with Z, Q, etc
then create a XLAT table so that the selected ASCII characters are assigned values 0 to 64
now, a 40-bit binary number (5 bytes) may be used to represent 6 unique characters...
let's call them Char1 - Char6
65^5 * Char6 + 65^4 * Char5 + 65^3 * Char4 + 65^2 * Char3 + 65 * Char2 + Char1
to unpack them, use modulo division
then translate them back to ASCII using the XLAT table
the resultant data looks like complete garbage
i got a little bit of compression out of it
plus i assured that the help/config file generated by my program would not be tampered with and redistributed
here is the old program...
http://www.masm32.com/board/index.php?action=dlattach;topic=11493.0;id=6257
notice that the zip file is 21 KB - and the config file generated by the 30 KB program is 17 KB
the program without the packed data is about 14 KB
Hi Paul,
Hexadecimal converts a 4 bit value i(that holds one of sixteen values)
into one of 16 printable characters. An eight bit code is broken into two
four bit values that can be converted.
Base 64 encoding uses 64 characters to encode a 6 bit value to printable
characters. UUEncode and XXEcode do this. Four six bit values equal three
eight bit values..
Base 85 is used by Mime, PostScript, and the (mostly Mac) BtoA
encodings. There is a penalty for any of these encodings in that the
number of characters expand. Hexadecimal is twice binary for instance.
To minimize the increase, base 85 uses five characters to encode four
bytes.
The idea is to take a 32 bit value, divide it repeatedly by 85, and use
one of 85 printable characters to represent the remainders. I use XLAT
to do the translations from binary to printable. The reverse is: take a
character, convert it into a number from 0 to 84, and accumulate by
multiplying by 85.
HTH,
Steve N.
;4 PostScript ASCII85 decoder
;4 use !=0 to u=84 and z as 5 zeroes ~> = EOD
;4 ! = 021H, u = 075H, z = 07AH, ~ = 07E
; -1 special indicator, -2 error
; 0 1 2 3 4 5 6 7 8 9 A B C D E F
XLATTBL DB -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -1, -2, -2, -1, -2, -2
DB -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -1, -2, -2, -2, -2, -2
DB -2, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
DB 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30
DB 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46
DB 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62
DB 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78
DB 79, 80, 81, 82, 83, 84, -2, -2, -2, -2, -1, -2, -2, -2, -1, -2
DB 128 DUP(-2)
Hi Paul,
An elaboration to {hopefully} clarify and expand on my previous
post. Plus the usual dumb excursion {sorry}.
From the PostScript Language Reference Manual: {paraphased}
Quote
Binary data bytes are encoded in 4-tuples (groups of 4). Each 4-tuple
is used to produce a 5-tuple of ASCII characters. If the binary 4-tuple
is (b1 b2 b3 b3) and the encoded 5-tuple is (c1 c2 c3 c4 c5), then the
relation between them is:
(b1 x 256^3) + (b2 x 256^2) + (b3 x 256) + b4 =
(c1 x 85^4) + (c2 x 85^3) + (c3 x 85^2) + (c4 x 85) + c5
In other words, four bytes of binary data are interpreted as a base-256
number and then convereted into a base-85 number. The five "digits" of
this number, (c1 c2 c3 c4 c5) are then converted into ASCII characters
by adding 33, which is the ASCII code for !, to each. ASCII characters
in the range ! to u are used, where ! represents the value 0 and u
represents the value 84. As a special case, if all five digits are
zero, they are represented by a single character z instead of by !!!!!.
And so on, and so forth. with the End-of-Data marker ~> explained.
Clear as fish right? Flounder anyone?
You can and add and subtract to do the conversions, but for the
decoder, I like the XLAT table, as it can reduce testing for the special
cases. Not much point for the encoder though. Except!
Now for the evil thought. As you are only creating this for your
own use, you need not follow the standard too closely. First, use a
non-standard number for the conversion. As 89 will not break anything,
and is prime (prime numbers are always fun by definition) you could
use that. It is a bit inefficient, so the Vulcan Science Council
will frown at you, so watch out. Then, using a lookup table, rather
than adding and subtracing, you can use a random sequence, rather than
the boring monotonic ordering. If it confuses your tamperers more than
it confuses you, it should help. Base-85 (or base-64 for that manner)
looks fairly random to begin with. A scrambled base-89 won't look much
different, but it will send Alice down a different rabbit hole.
Actually sounds like a fun little project.
Cheers,
Steve N.