ToString() public method

public ToString ( ) : string
return string
コード例 #1
0
    public string UploadEvaluator(ServerEvaluator myEval)
    {
        Console.WriteLine("upload. eval string: " + myEval.ToString());

        string idCode;
        Random rnd      = new Random();
        string password = myEval.Name + rnd.Next().ToString();
        string hashed   = BCrypt.HashPassword(password, BCrypt.GenerateSalt(10));

        //insert the password in the server and the hash in the client
        myEval.Code = password;

        int id = myEval.InsertAtDB(false);         //do insertion

        return(id.ToString() + ":" + hashed);
    }
コード例 #2
0
    public bool EditEvaluator(ServerEvaluator clientEval, int evalSID)
    {
        Console.WriteLine("edit. eval string: " + clientEval.ToString());

        ServerEvaluator serverEval = SqliteServer.SelectEvaluator(evalSID);

        //serveEval.Code is password
        //clientEval.Code is hash
        bool matches = BCrypt.CheckPassword(serverEval.Code, clientEval.Code);

        if (matches)
        {
            //put the uniqueID that corresponds in server
            clientEval.UniqueID = evalSID;

            //put the pass code instead of the client password hash
            clientEval.Code = serverEval.Code;

            clientEval.Update(false);             //do update
            return(true);
        }

        return(false);
    }
コード例 #3
0
    public string UploadEvaluator(ServerEvaluator myEval)
    {
        Console.WriteLine("upload. eval string: " + myEval.ToString());

        string idCode;
        Random rnd = new Random();
        string password = myEval.Name + rnd.Next().ToString();
        string hashed = BCrypt.HashPassword(password, BCrypt.GenerateSalt(10));

        //insert the password in the server and the hash in the client
        myEval.Code = password;

        int id = myEval.InsertAtDB(false); //do insertion

        return id.ToString() + ":" + hashed;
    }
コード例 #4
0
    public bool EditEvaluator(ServerEvaluator clientEval, int evalSID)
    {
        Console.WriteLine("edit. eval string: " + clientEval.ToString());

        ServerEvaluator serverEval = SqliteServer.SelectEvaluator(evalSID);

        //serveEval.Code is password
        //clientEval.Code is hash
        bool matches = BCrypt.CheckPassword(serverEval.Code, clientEval.Code);
        if(matches) {
            //put the uniqueID that corresponds in server
            clientEval.UniqueID = evalSID;

            //put the pass code instead of the client password hash
            clientEval.Code = serverEval.Code;

            clientEval.Update(false); //do update
            return true;
        }

        return false;
    }