atomaka.com/_posts/2013-09-25-password-checking-in-c.md

1.4 KiB

layout title tag
post Password Checking in C
humor
if (strlen(encrytedenteredpassword) != 13) {
  passwordcorrect=0;
} else {
  for (i=0; i<13;i++) {
    switch (i) {
    case 0:
      if (encrytedenteredpassword[i] != 'f') passwordcorrect=0;
      break;
    case 1:
      if (encrytedenteredpassword[i] != 'J') passwordcorrect=0;
      break;
    case 2:
      if (encrytedenteredpassword[i] != 'c') passwordcorrect=0;
      break;
    case 3:
      if (encrytedenteredpassword[i] != 'l') passwordcorrect=0;
      break;
    case 4:
      if (encrytedenteredpassword[i] != 'Q') passwordcorrect=0;
      break;
    case 5:
      if (encrytedenteredpassword[i] != 'v') passwordcorrect=0;
      break;
    case 6:
      if (encrytedenteredpassword[i] != 'P') passwordcorrect=0;
      break;
    case 7:
      if (encrytedenteredpassword[i] != 'i') passwordcorrect=0;
      break;
    case 8:
      if (encrytedenteredpassword[i] != 'l') passwordcorrect=0;
      break;
    case 9:
      if (encrytedenteredpassword[i] != 'N') passwordcorrect=0;
      break;
    case 10:
      if (encrytedenteredpassword[i] != 'A') passwordcorrect=0;
      break;
    case 11:
      if (encrytedenteredpassword[i] != 'z') passwordcorrect=0;
      break;
    case 12:
      if (encrytedenteredpassword[i] != '.') passwordcorrect=0;
      break;
    default: passwordcorrect=0; break;
    }
    if (!passwordcorrect) break;
  }
}