pupilo / cubix Goto Github PK
View Code? Open in Web Editor NEWAlgoritimo para criptografia baseado no cubo de Rubik
Algoritimo para criptografia baseado no cubo de Rubik
Adicionar no .gitignore os arquivos com extensão .cub.
Acredito que pra tornar o codigo mais efetivo e menos hardcoded, cada lado do cubo deveria ser colocado em um vetor, assim o cubo conteria um vetor de lados e as funções que fossem manipular esses lados n iriam precisar ser chamadas varias vezes! (redução do overhead)
Outra coisa que acredito que poderia ajudar na manutenção do codigo é a técnica de early return. Segue um link explicativo:
https://en.wikibooks.org/wiki/Computer_Programming/Coding_Style/Minimize_nesting#Early_return
Ao criptografar o texto André Coelho Caribé de Azevedo
eu obtive:
Avdro© .oenh...aCibl© e rzeÃe...ÿA....oÃC......dd
...
Ao descriptografar:
André Coelho Caribé de Azevedo
ÿ....................
Creio que o algoritmo não esteja trabalhando bem com caracteres especiais. Seria possível trabalhar com uma codificação como UTF-8?
Segue o diff, basta pegar o meu branch "working" e fazer um merge.
Diff link:
UserXGnu@99470e9
Mac OS 10.7.5 (64bits)
GCC Using built-in specs.
Target: i686-apple-darwin11
Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.9~22/src/configure --disable-checking --enable-werror --prefix=/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.9~22/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.9.00)
Output da compilação com ./compilar.sh
Ambar:CubiX andrecaribe$ ./compilar.sh
Engine.c: In function ‘calculate_matrix’:
Engine.c:103: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long int’
Engine.c:103: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long int’
Engine.c: In function ‘P_Matriz’:
Engine.c:235: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long long int’
Engine.c:235: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long long int’
Engine.c:236: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long long int’
Engine.c:236: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long long int’
Rotations.c: In function ‘from_rotation’:
Rotations.c:51: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long long int’
Rotations.c:51: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long long int’
Rotations.c:52: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long long int’
Rotations.c:52: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long long int’
Rotations.c: In function ‘from_rotation_invers’:
Rotations.c:82: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long long int’
Rotations.c:82: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long long int’
Rotations.c:83: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long long int’
Rotations.c:83: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long long int’
Rotations.c: In function ‘X_rotation’:
Rotations.c:112: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long long int’
Rotations.c:112: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long long int’
Rotations.c:113: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long long int’
Rotations.c:113: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long long int’
Rotations.c: In function ‘X_rotation_invers’:
Rotations.c:145: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long long int’
Rotations.c:145: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long long int’
Rotations.c:146: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long long int’
Rotations.c:146: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long long int’
Rotations.c: In function ‘Y_rotation’:
Rotations.c:177: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long long int’
Rotations.c:177: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long long int’
Rotations.c:178: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long long int’
Rotations.c:178: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long long int’
Rotations.c: In function ‘save_cubic_revers’:
Rotations.c:287: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long long int’
Rotations.c:287: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long long int’
Rotations.c:299: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long long int’
Rotations.c:299: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long long int’
Rotations.c:311: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long long int’
Rotations.c:311: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long long int’
Rotations.c:323: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long long int’
Rotations.c:323: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long long int’
Rotations.c:335: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long long int’
Rotations.c:335: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long long int’
Rotations.c:347: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long long int’
Rotations.c:347: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long long int’
Undefined symbols for architecture x86_64:
"_fcloseall", referenced from:
_save_cubic in Rotations.o
_save_cubic_revers in Rotations.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.