Create Checksum (PSP)
No notes
Syntax:
C
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); }