The MASM Forum

General => The Laboratory => Topic started by: cpu2 on April 03, 2014, 03:41:12 PM

Title: Mixcolumns ordination
Post by: cpu2 on April 03, 2014, 03:41:12 PM
Hello

I`m implementing the function Mixcolunms. I`m on the step of instructing the double word, they do it with shift bits.

I wonder if there is a better way. I cant not use pshufb. I can show what i have done.

Thanks an sorry for my expression.

Title: Re: Mixcolumns ordination
Post by: Gunther on April 03, 2014, 07:41:52 PM
Hi cpu2,

please show us your code and we'll see what can be done.

Gunther
Title: Re: Mixcolumns ordination
Post by: dedndave on April 04, 2014, 02:39:50 AM
this isn't exactly what you are looking for
but, it is pretty cool and might give you ideas to work with

Drizz "Stir Fry" bitswap
http://www.masmforum.com/board/index.php?topic=12722.msg98224#msg98224 (http://www.masmforum.com/board/index.php?topic=12722.msg98224#msg98224)
Title: Re: Mixcolumns ordination
Post by: cpu2 on April 04, 2014, 07:26:00 AM
Okay, i will read the link.

This is the implementation.

bts0_: .quad 0x8080808080808080,0x8080808080808080    ; 0x600218
dlb0_: .quad 0x7f7f7f7f7f7f7f7f,0x7f7f7f7f7f7f7f7f    ; 0x600228
xrb0_: .quad 0x1b1b1b1b1b1b1b1b,0x1b1b1b1b1b1b1b1b    ; 0x600238

.section .text
.globl _start

_start:

//// intel_syntax

//// xmm0 = 2 x ; xmm1 = 1 x ; xmm2 = 3 x

movdqa xmm1, xmm0
movdqa xmm2, xmm1
pand xmm0, 0x600218
pcmpeqb xmm0, 0x600218
movdqa xmm3, xmm0
pand xmm1, xmm0
pandn xmm0, xmm2
pand xmm1, 0x600228
pslld xmm0, 1
pslld xmm1, 1
pxor xmm1, 0x600238
pand xmm1, xmm3
pxor xmm0, xmm1
pxor xmm2, xmm0


Only is the ordination an XOR. As seen?

Thanks.
Title: Re: Mixcolumns ordination
Post by: cpu2 on April 15, 2014, 03:58:52 AM
Already solved the problem. I use the pslld/psrld and movdqa instructions, for the ordination.

If i want the result, say.

Regards.