Create Checksum (PSP)

by nniicccoo on August 6th, 2010
No notes
Syntax: C
Show lines - Hide lines - Show in textbox - Download
	void CreatChecksum(int *infile, int *outfile) 
	{
	SceUID in, out;
	u8 sha[20];
	char buffer[10485760];
 
	in = sceIoOpen(infile, PSP_O_RDONLY, 0777);
	if(in < 0)
	{
	Error("Unable to open Input File!");
	return -1;
	}
 
	out = sceIoOpen(outfile, PSP_O_RDONLY, 0777);
	if(out < 0)
	{
	Error("Unable to create Output File!");
	return -2;
	}
 
	sceIoLseek(in, 0, PSP_SEEK_END);
	memset(buffer, 0, sizeof(in);
	sceIoRead(in, buffer, sizeof(in);
 
	SceKernelUtilsSha1Context ctx;
	sceKernelUtilsSha1BlockInit(&ctx);
	sceKernelUtilsSha1BlockUpdate(&ctx, buffer, sizeof(in));
	sceKernelUtilsSha1BlockResult(&ctx, sha);
 
	sceIoWrite(out, sha, sizeof(sha)); 
 
	sceIoClose(out);
	sceIoClose(in);
	}

Leave a Reply

Note: XHTML is allowed. Your email address will never be published.

Subscribe to this comment feed via RSS