popsdeco

md5... still not working...

Oct 17th, 2011
39
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. {
  2. int fd=sceIoOpen(save,PSP_O_RDONLY,0777);
  3. if(fd>=0){
  4. //MD5_CTX md5ctx;
  5. SceKernelUtilsMd5Context md5ctx;
  6. unsigned char digest[16];
  7. char md5[33];md5[32]=0;
  8. //MD5Init(&md5ctx);
  9. sceKernelUtilsMd5BlockInit(&md5ctx);
  10. int size=0;
  11. int readlen;
  12. while((readlen=sceIoRead(fd,buf,sizeof buf))>0){
  13. //MD5Update(&md5ctx,(unsigned char*)buf,readlen);
  14. sceKernelUtilsMd5BlockUpdate(&md5ctx, buf , readlen);
  15. size+=readlen;
  16. }
  17. DBG_LOG( "size %d\n", size );
  18. //MD5Final(digest,&md5ctx);
  19. sceKernelUtilsMd5BlockResult(&md5ctx, digest);
  20. int i=0;
  21. for(;i<16;i++){
  22. int x=digest[i]>>4,y=digest[i]&0xf;
  23. md5[2*i+0]=x>9?(x-10+'a'):(x+'0');
  24. md5[2*i+1]=y>9?(y-10+'a'):(y+'0');
  25. }
  26. sceIoClose(fd);
  27. if(!strcmp(remote_md5,md5)){
  28. printf( "No need to update %s.\n", save );
  29. DBG_LOG( "No need to update %s.\n", save );
  30. return 1;
  31. }
  32. }
  33. }
  34.  
RAW Paste Data