fork download
  1. #include <stdio.h>
  2. #include <string.h>
  3. unsigned long hashcode = 0x21DD09EC; unsigned long check_password(const char* p){
  4. int* ip = (int*)p; int i;
  5. int res=0;
  6. for(i=0; i<5; i++){
  7. res += ip[i];
  8. }
  9. return res;
  10. }
  11.  
  12. int main(int argc, char* argv[]){
  13. if(argc<2){
  14. printf("usage : %s [passcode]\n", argv[0]);
  15. return 0;
  16. }
  17. if(strlen(argv[1]) != 20){
  18. printf("passcode length should be 20 bytes\n");
  19. return 0;
  20. }
  21.  
  22. if(hashcode == check_password( argv[1] )){
  23. system("/bin/cat flag");
  24. return 0;
  25. }
  26. else
  27. printf("wrong passcode.\n");
  28. return 0;
  29. }
Success #stdin #stdout 0.01s 5280KB
stdin
10 10 10 10
stdout
usage : ./prog [passcode]