Skip to content

Instantly share code, notes, and snippets.

@co3moz
Last active November 9, 2022 11:29
Show Gist options
  • Save co3moz/9559d9f8a4ca741df3b9fba5f83faa8d to your computer and use it in GitHub Desktop.
Save co3moz/9559d9f8a4ca741df3b9fba5f83faa8d to your computer and use it in GitHub Desktop.
TC Kimlik no doğrulama, adam akıllı sürümü
// Millet evalle tc kimlik doğrulama yazmış. Manyak la bunlar
// 10. satırda 7 * t - c negatif çıkması durumunda hesabın bozulmaması için +30 yapılmıştır. (Bazı insanların negatif çıkabiliyor)
function tcKimlikKontrol(s) {
if (!(/^[1-9]\d{9}[02468]$/.test(s))) return false;
var t = +s[0] + +s[2] + +s[4] + +s[6] + +s[8],
c = +s[1] + +s[3] + +s[5] + +s[7];
if (s[9] != ((30 + t * 7 - c) % 10)) return false;
return s[10] == ((8 * t) % 10);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment