Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace KaficApp.Logic
- {
- static partial class PrijavaLogic
- {
- public static int autentifikacijaKorisnika(string korisnickoIme, string lozinka)
- {
- using (var db = new KaficDB())
- {
- var query = from korisnici in db.Korisniks orderby korisnici.ID_korisnik select korisnici;
- foreach (var korisnik in query.ToList<Korisnik>())
- {
- if(korisnik.Username == korisnickoIme)
- {
- if(korisnik.Password == lozinka)
- {
- return korisnik.ID_tip_korisnika;
- }
- }
- }
- return 0;
- }
- }
- }
- }
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace KaficApp.Logic
- {
- public class Crypto
- {
- public static string sha256(string pw)
- {
- System.Security.Cryptography.SHA256Managed crypt = new System.Security.Cryptography.SHA256Managed();
- System.Text.StringBuilder hash = new System.Text.StringBuilder();
- byte[] crypto = crypt.ComputeHash(Encoding.UTF8.GetBytes(pw), 0, Encoding.UTF8.GetByteCount(pw));
- foreach (byte theByte in crypto)
- {
- hash.Append(theByte.ToString("x2"));
- }
- return hash.ToString();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement