lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Sun, 5 Jul 2020 01:31:37 +0100
From:   Andre Coelho <andrealbergaria@...il.com>
To:     linux-kernel@...r.kernel.org
Subject: fast binary calculator

ey


Ive made a program, that uses bit flips to quickly represent binary numbers

for instance, if i use a 128bit number than the algorithm uses

128+128+128 (and not 128*128)

for each bit.

Basically, it assigns slots to bits, so for instance

pos 1    pos 2 pos 3

0             0       0

1            1      1

so that reduces the time it takes to scan them. I also use bit flips to 
change the bit on a particular slot.


i wrote both c and java files.


later


Here is the code in c

#include <stdio.h>


char flipBit(char c);

char flipBit(char c) {
     if (c == '0')
         return '1';
     else
         return '0';



}


int main() {





                         char binaryNumber[] = { '0','0','0','0',0 };
                         int slot1,slot2,slot3,slot4;


                         for (slot1=0 ; slot1 < 2 ; slot1++) {
                             printf("\n%s",binaryNumber);
                             for (slot2 =1 ; slot2 < 2 ; slot2++) {
                                 binaryNumber[slot2] = 
flipBit(binaryNumber[slot2]);

                                 printf("\n%s",binaryNumber);

                                 for (slot3=2 ; slot3 < 3 ; slot3++) {
                                     binaryNumber[slot3] = 
flipBit(binaryNumber[slot3]);
                                     printf("\n%s",binaryNumber);


                                     for (slot4=3 ; slot4 < 4 ; slot4++) {
                                         binaryNumber[slot4] = 
flipBit(binaryNumber[slot4]);
printf("\n%s",binaryNumber);
                                     }
                                 }

                             }
                             binaryNumber[slot1] = 
flipBit(binaryNumber[slot1]);
                             printf("\n");
                         }



}

-- 
André Albergaria Coelho
andrealbergaria@...il.com


View attachment "binPath.c" of type "text/x-csrc" (964 bytes)

View attachment "binPath.java" of type "text/x-java" (1586 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ