Re: Xor encryption



On 8 mrt, 19:29, rossum <rossu...@xxxxxxxxxxxx> wrote:
On 8 Mar 2007 05:18:19 -0800, cvsc...@xxxxxxxxx wrote:

Hi,

To communicate with a LED sign I need to calculate a checksum of the
message.
If message is 'bas' the checksum is '04'.
How can I calculate the checksum? (I need it in VB.net, bus other
language is no problem)
Or do I need a key to Xor with?

Examples: (last 2 chars =checksum)



a15

'a' = 0x61 = 0110 0001
0x15 = 0001 0101 (checksum)
XOR = 0111 0100 = 0x74

b16

'b' = 0x62 = 0110 0010
0x16 = 0001 0110 (checksum)
XOR = 0111 0100 = 0x74

Do you see the pattern?

c17
d10
e11
f12
g13
h1C
i1D
j1E
k1F
bas04

'b' = 0x62 = 0110 0010
'a' = 0x61 = 0110 0001
's' = 0x73 = 0111 0011
0x04 = 0000 0100 (checksum)
XOR = 0111 0100 = 0x74

Do you see the pattern?

bes00
besss00
bessst74
bessstt00

Thanks in advance

You can calculate the XOR of all the characters in your string, call
this X. You also have a checksum, which you do not know, and you
should be able to work out what (X xor checksum) is from the pattern
above. Note that X xor (X xor checksum) = checksum and you have
solved your problem.

This is not an encryption by the way, it is just a simple XOR
checksum.

rossum

Thanks for the support.
Meanwhile I got the communication protocol. Now I now for sure the
cecksum is calculated with Xor, but how exactly is not mentioned.
I still didn't figure out how to calculated it.
I tried this in VB.NET:

Function xorit(ByVal s As String) As String
Dim Character As Char
Dim Checksum As Integer
For Each Character In s
Checksum = Checksum Xor Convert.ToByte(Character)
Next
Return Checksum.ToString("X2")
End Function

With this function the alphabet returns:

a: 61 must be 15
b: 62 must be 16
c: 63 must be 17
d: 64 must be 10
e: 65 must be 11
f: 66 must be 12
g: 67 must be 13
h: 68 must be 1C
i: 69 must be 1D
j: 6A
k: 6B
l: 6C
m: 6D
n: 6E
o: 6F
p: 70
q: 71
r: 72
s: 73
t: 74
u: 75
v: 76
w: 77
x: 78
y: 79
z: 7A

not the value's I wanted...

.



Relevant Pages

  • Re: hexadecimal calculating: turning on the high bit
    ... checksum byte and an end byte ... function VetmessageChecksum(vetmessage: string): string; ... iChecksum: integer; ... any more two character bits left. ...
    (alt.comp.lang.borland-delphi)
  • Re: Crypto Mini-FAQ
    ... >> often that attacks are possible. ... >> checksum is linear. ... Nikita Borisov, Ian Goldberg, and David Wagner. ... linear checksums commute with xor. ...
    (sci.crypt)
  • Re: Cant understand this code snippet
    ... I only know it's trying to XOR the process ID. ... ps -A lists all the processes on a Unix machine. ... giving you a list of random longs. ... It causes pack to compute a checksum out of those ...
    (perl.beginners)
  • Re: Sending commands to a GPS module
    ... I know the Doc's say Xor with characters between the $ and * how ever, ... each char maybe with FF and then summing.. ... variable and store result to the variable, convert checksum to ... control characters). ...
    (sci.electronics.design)
  • Re: Need Help With Decription
    ... every string wich is send the the LED has a sort of ... XOR all characters including the checksum character and compare ... I know it is encrypted with XOR. ... Select one of your examples above and XOR all characters of the message + the ...
    (sci.crypt)