Last active
November 9, 2022 11:29
-
-
Save co3moz/9559d9f8a4ca741df3b9fba5f83faa8d to your computer and use it in GitHub Desktop.
TC Kimlik no doğrulama, adam akıllı sürümü
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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