B
b
I have the idea, but I do not know how to program something like this:
Create sorted list with numbers
1
11
111
1111
....
2
22
222
2222
....
to
F
FF
FFF
1
2
3
4
5
6
7
8
9
a
b
c
d
e
f
11
22
33
44
....
EEEEEEEEEEEEEEEE <---16 x E
FFFFFFFFFFFFFFFF <---16 x F
sorted list would look like this:
1
2
3
....
Read first n hex digits of some test file (%H) (n is the biggest
number , 16 if possible)
compare it with the list.
If %H matches number on list, great. Else:
Find first bigger number (%B) than %H.
%S = one number up on list, smaller than %H, unless maching number has
index(0),
and it is first on list.
Find %B - %H = %BR
Find %H - %S = %SR
If %H matches number on list, use that number. Else:
If %BR > %SR , use bigger number, %B. Otherwise use %S.
If they are the same use, %BR?
Write in new file %B or %S as number of digits: If %B or %S is FFFFFF,
then write it as
5F (5 times F). Write length of %BR or %SR, with two hex
numbers. Then write %BR or %SR. Next n digits.
In the begining there should be something like algorithm version.
there should be some some crc checking.
Is there someone who does?
Create sorted list with numbers
1
11
111
1111
....
2
22
222
2222
....
to
F
FF
FFF
1
2
3
4
5
6
7
8
9
a
b
c
d
e
f
11
22
33
44
....
EEEEEEEEEEEEEEEE <---16 x E
FFFFFFFFFFFFFFFF <---16 x F
sorted list would look like this:
1
2
3
....
Read first n hex digits of some test file (%H) (n is the biggest
number , 16 if possible)
compare it with the list.
If %H matches number on list, great. Else:
Find first bigger number (%B) than %H.
%S = one number up on list, smaller than %H, unless maching number has
index(0),
and it is first on list.
Find %B - %H = %BR
Find %H - %S = %SR
If %H matches number on list, use that number. Else:
If %BR > %SR , use bigger number, %B. Otherwise use %S.
If they are the same use, %BR?
Write in new file %B or %S as number of digits: If %B or %S is FFFFFF,
then write it as
5F (5 times F). Write length of %BR or %SR, with two hex
numbers. Then write %BR or %SR. Next n digits.
In the begining there should be something like algorithm version.
there should be some some crc checking.
Is there someone who does?