86 / 132 page

Handshake Solutions
HT80C51 User Manual
Peripheral Modules – Triple-DES Converter
Page 86 of 132
© Philips Electronics N.V. 2005
Sometimes the text is in a different (reversed) byte order. Then following sequence can be used:
; Store key in KEY0
(the byte order of the keys cannot be changed)
MOV
DKEY, #B8h
MOV
DKEY, #B7h
MOV
DKEY, #B6h
MOV
DKEY, #B5h
MOV
DKEY, #B4h
MOV
DKEY, #B3h
MOV
DKEY, #B2h
MOV
DKEY, #B1h
MOV
DCON, #00h
; Write plain text into DTXT (reversed order)
MOV
DTXT, #3Dh
MOV
DTXT, #9Dh
MOV
DTXT, #3Fh
MOV
DTXT, #A9h
MOV
DTXT, #FCh
MOV
DTXT, #8Ah
MOV
DTXT, #D3h
MOV
DTXT, #37h
MOV
DCON, #3
; reverse byte order
; Invoke a single-DES encrytion
MOV
DCON, #4
; the generated cipher text is F64E59B5B5A36506
; Reading the result
(reversed order)
MOV
DCON, #3
; reverse byte order for read-out
MOV
R7, DTXT
MOV
R6, DTXT
MOV
R5, DTXT
MOV
R4, DTXT
MOV
R3, DTXT
MOV
R2, DTXT
MOV
R1, DTXT
MOV
R0, DTXT
; will result with value 06h in R0, 65h in R1, etc.