// File: /workspace/github_cpp_makefile_star2_O1/Tarstingo[P]rarcrack/crackrar.cpp
// Function: Bsha1(std::vector<unsigned char, std::allocator<unsigned char>>, unsigned char*)
void Bsha1(std::vector<muchar> M,muchar *B)
{
    timespec tmptime,nowtime;
    clock_gettime(CLOCK_REALTIME,&tmptime);

    SHA_CTX ctx;
    SHA1_Init(&ctx);
    for(int i=0;i<0x40000;i++)
    {
        muchar tmp[M.size()+3];
        for(unsigned int j=0;j<M.size();j++)
        {
            tmp[j]=M[j];
        }
        tmp[M.size()]=(i&0x0000ff);
        tmp[M.size()+1]=((i&0x00ff00)>>8);
        tmp[M.size()+2]=((i&0x0f0000)>>16);
        SHA1_Update(&ctx,tmp,M.size()+3);
    }
    SHA1_Final(B,&ctx);

    clock_gettime(CLOCK_REALTIME,&nowtime);
    printf("\033[31mBsha1\033[m\n");
    if(tmptime.tv_nsec>nowtime.tv_nsec)
    {
        cout<<"0s   "<<1000000000-nowtime.tv_nsec+tmptime.tv_nsec<<" ns"<<endl;
    }
    else
    {
        cout<<"0s   "<<nowtime.tv_nsec-tmptime.tv_nsec<<" ns"<<endl;
    }

    cout<<tmptime.tv_sec<<" "<<tmptime.tv_nsec<<endl;
    cout<<nowtime.tv_sec<<" "<<nowtime.tv_nsec<<endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rsi, %r12
movq %rdi, %r14
xorl %ebx, %ebx
leaq -0x38(%rbp), %rsi
xorl %edi, %edi
callq 0x2130
leaq -0xa8(%rbp), %r15
movq %r15, %rdi
callq 0x2100
movq %rsp, %r13
movq 0x8(%r14), %rax
subq (%r14), %rax
addq $0x12, %rax
andq $-0x10, %rax
movq %rsp, %rsi
subq %rax, %rsi
movq %rsi, %rsp
movq (%r14), %rax
movq 0x8(%r14), %rdx
subq %rax, %rdx
je 0x299b
xorl %ecx, %ecx
movb (%rax,%rcx), %dil
movb %dil, (%rsi,%rcx)
incq %rcx
movl %ecx, %edi
cmpq %rdi, %rdx
ja 0x2989
movb %bl, (%rsi,%rdx)
movb %bh, 0x1(%rsi,%rdx)
movl %ebx, %eax
shrl $0x10, %eax
movb %al, 0x2(%rsi,%rdx)
addq $0x3, %rdx
movq %r15, %rdi
callq 0x2070
movq %r13, %rsp
incl %ebx
cmpl $0x40000, %ebx          # imm = 0x40000
jne 0x2960
leaq -0xa8(%rbp), %rsi
movq %r12, %rdi
callq 0x2200
leaq -0x48(%rbp), %rbx
xorl %edi, %edi
movq %rbx, %rsi
callq 0x2130
leaq 0x1680(%rip), %rdi      # 0x4068
callq 0x21e0
movq -0x30(%rbp), %r15
movq 0x8(%rbx), %r12
movq 0x35dc(%rip), %r14      # 0x5fd8
leaq 0x1601(%rip), %rsi      # 0x4004
movl $0x5, %edx
movq %r14, %rdi
callq 0x2190
movq 0x8(%rbx), %rax
movq -0x30(%rbp), %rsi
movq %rax, %rcx
subq %rsi, %rcx
subq %rax, %rsi
addq $0x3b9aca00, %rsi       # imm = 0x3B9ACA00
cmpq %r12, %r15
cmovleq %rcx, %rsi
movq %r14, %rdi
callq 0x2140
movq %rax, %r15
leaq 0x15c9(%rip), %rsi      # 0x400a
movl $0x3, %edx
movq %rax, %rdi
callq 0x2190
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq %r15, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20e0
movq -0x38(%rbp), %rsi
movq %r14, %rdi
callq 0x2140
movq %rax, %r12
leaq 0x157d(%rip), %r15      # 0x4008
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x2190
movq -0x30(%rbp), %rsi
movq %r12, %rdi
callq 0x2140
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq %r12, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20e0
movq (%rbx), %rsi
movq %r14, %rdi
callq 0x2140
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x2190
movq 0x8(%rbx), %rsi
movq %r14, %rdi
callq 0x2140
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20e0
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq