crypto++ and libhash++ ported
crypto++ and libhash++ ported
I've ported libcrypto++ an libhash++ to the psp.
I hope i made the makefile portable. It compiles/installs fine using my windows VISTA+minpspw.
libcrypto++
Sendspace mirror:
http://www.sendspace.com/file/ynspg2
libhash++
Sendspace mirror:
http://www.sendspace.com/file/x0xfae
I hope i made the makefile portable. It compiles/installs fine using my windows VISTA+minpspw.
libcrypto++
Sendspace mirror:
http://www.sendspace.com/file/ynspg2
libhash++
Sendspace mirror:
http://www.sendspace.com/file/x0xfae
Last edited by jojojoris on Thu Mar 05, 2009 1:35 am, edited 1 time in total.
Code: Select all
int main(){
SetupCallbacks();
makeNiceGame();
sceKernelExitGame();
}
DoneDariusc123456 wrote:Can you upload it to sendspace.com?
Code: Select all
int main(){
SetupCallbacks();
makeNiceGame();
sceKernelExitGame();
}
well you can encrypt and decrypt things with this.
I made an example today which shows a working way to decrypt and encrypt a file using AES:
main.cpp
makefile:
I made an example today which shows a working way to decrypt and encrypt a file using AES:
main.cpp
Code: Select all
#include <pspkernel.h>
#include <pspdebug.h>
#include <cstdio>
#include "cryptopp/modes.h"
#include "cryptopp/aes.h"
using namespace CryptoPP;
/* Define the module info section */
PSP_MODULE_INFO("template", 0, 1, 1);
/* Define the main thread's attribute value (optional) */
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER | THREAD_ATTR_VFPU);
#define printf pspDebugScreenPrintf
long getFileSize(const char *filename){
long size;
FILE *pFile;
pFile = fopen (filename,"r");
fseek( pFile, 0L, SEEK_END );
size=ftell( pFile );
fclose(pFile);
return size;
}
void encryptData(const char *pakname,const char *filename,byte *key){
long filesize=getFileSize(filename);
FILE *pFile;
pFile = fopen (filename,"r");
byte iv[AES::BLOCKSIZE];
AES::Encryption aesEncryption(key, AES::DEFAULT_KEYLENGTH);
CFB_Mode_ExternalCipher::Encryption cfbEncryption(aesEncryption, iv);
byte plain[filesize], cipher[filesize];
fread(plain,filesize,1,pFile);
fclose (pFile);
cfbEncryption.ProcessData(cipher, plain, filesize);
pFile = fopen( pakname ,"wb");
fwrite (cipher , 1 , filesize , pFile );
fclose (pFile);
}
void decryptData(const char *pakname,const char *filename,byte *key){
long filesize=getFileSize(pakname);
FILE *pFile;
byte iv[AES::BLOCKSIZE];
pFile = fopen( pakname ,"r");
byte decry[filesize], encry[filesize];
fread(encry,filesize,1,pFile);
fclose (pFile);
CFB_Mode<AES>::Decryption cfbDecryption(key, 16, iv);
cfbDecryption.ProcessData(decry, encry, filesize);
pFile = fopen( filename ,"wb");
fwrite (decry , 1 , filesize , pFile );
fclose (pFile);
}
int main(int argc, char *argv[]) {
pspDebugScreenInit();
printf("Start test\n");
byte key[]="keytest";
printf("Key is '%s'\n",key);
encryptData("data.pak","test.zip",key);
printf("encrypted \n");
decryptData("data.pak","data.zip",key);
printf("decrypted \n");
sceKernelDelayThread(5000000);
sceKernelExitGame();
return 0;
}
Code: Select all
TARGET = template
OBJS = main.o
BUILD_PRX=1
INCDIR =
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS)
ASFLAGS = $(CFLAGS)
EXTRA_TARGETS=EBOOT.PBP
LIBDIR =
LIBS= -lcryptopp -lstdc++ -lm
LDFLAGS =
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak
Code: Select all
int main(){
SetupCallbacks();
makeNiceGame();
sceKernelExitGame();
}
libhash++ is just hashes link MD5 and SHA
libcrypto++ has encryption like AES etc. (and md5 as sha things) so you can decrypt it back.
I even don't know what those all does...
I ported them and the sees to work (at least the things i tested).
libcrypto++ has encryption like AES etc. (and md5 as sha things) so you can decrypt it back.
I even don't know what those all does...
I ported them and the sees to work (at least the things i tested).
Code: Select all
int main(){
SetupCallbacks();
makeNiceGame();
sceKernelExitGame();
}