Skip to content

Instantly share code, notes, and snippets.

Created November 11, 2016 15:23
Show Gist options
  • Save anonymous/cfd9cb3465724e62fb05e653a8385a93 to your computer and use it in GitHub Desktop.
Save anonymous/cfd9cb3465724e62fb05e653a8385a93 to your computer and use it in GitHub Desktop.
//replacement constant
pub const P: [u8; 256] = [...];
//swapping constant
pub const T: [usize; 64] = [....];
// actual code
let mut block = [0u8; 64];
for (b, j) in h.iter().zip(T.iter()) {
block[*j] = P[*b as usize];
}
// perf annotate
│ let mut block = [0u8; BLOCK_SIZE]; ▒
│ for (b, j) in h.iter().zip(T.iter()) { ▒
│ block[*j] = P[*b as usize]; ▒
0,15 │ lea streebog::consts::T::hb7715e7a04949269,%rcx ▒
0,07 │ lea const14850,%rdx ▒
0,18 │ data16 data16 nopw %cs:0x0(%rax,%rax,1) ▒
1,14 │ 80: mov (%rcx,%rax,8),%rsi ▒
8,21 │ movzbl (%r14,%rax,1),%edi ▒
5,02 │ movzbl (%rdi,%rdx,1),%ebx ▒
16,92 │ mov %bl,-0x60(%rbp,%rsi,1) ▒
0,70 │ mov 0x8(%rcx,%rax,8),%rsi ▒
2,20 │ movzbl 0x1(%r14,%rax,1),%edi ▒
│ _ZN4core4iter8{{impl}}52next<core::slice::Iter<u8>,core::slice::Iter<usize>>E(): ▒
2,50 │ lea 0x2(%rax),%rax ▒
│ _ZN8streebog8streebog3lpsE(): ◆
10,06 │ movzbl (%rdi,%rdx,1),%ebx ▒
6,44 │ mov %bl,-0x60(%rbp,%rsi,1) ▒
│ _ZN4core4iter8{{impl}}52next<core::slice::Iter<u8>,core::slice::Iter<usize>>E(): ▒
0,01 │ cmp $0x40,%rax ▒
1,61 │ ↑ jne 80 ▒
│ _ZN8streebog8streebog3lpsE(): ▒
0,04 │ xor %ebx,%ebx ▒
│ }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment