小编Uts*_*rai的帖子

密码哈希不匹配

我无法登录用户,因为密码哈希不匹配。我究竟做错了什么。我保存密码哈希的 sql 服务器的数据类型为 nvarchar。我之前使用过二进制数据类型,但它不起作用。

 private readonly MovieHubContext _context;
    public AuthRepository(MovieHubContext context)
    {
        _context = context;
    }

    //method is called when the user hits the login button
    public async Task<Users> Login(string username, string password)
    {
        //returns the username from the databse
        var user = await _context.Users.FirstOrDefaultAsync(x => x.UserName == username);
        if (user == null)
        {
            return null;
        }

        if (!VerifyPasswordHash(password, System.Text.Encoding.UTF8.GetBytes(user.PasswordHash),
            System.Text.Encoding.UTF8.GetBytes(user.PasswordSalt)))
            return null;
        return user;

    }
    // this method is used to verify the password 
    private bool VerifyPasswordHash(string password, byte[] …
Run Code Online (Sandbox Code Playgroud)

c# authentication asp.net-mvc cryptography asp.net-core

3
推荐指数
1
解决办法
554
查看次数

如何在新行中写入记录。(在output.dat上)

我正在尝试将当前控制台显示输出到TFileOut.da文件。但是,当我尝试写一条记录时,所有数据都输出到同一行。

       PROGRAM-ID. TFile.
       ENVIRONMENT DIVISION.
       INPUT-OUTPUT SECTION.
       FILE-CONTROL.
        SELECT myInFile ASSIGN TO "TestFile.dat".
        SELECT myOutFile ASSIGN TO "TFileOut.dat".
       DATA DIVISION.
       FILE SECTION.
       FD myInFile.
       01 inRecord.
        02 StudentName    PIC X(15).
        02 StudentWNbr    PIC X(8).
        02 Years          PIC X(9).
        02 Course         PIC X(9).
        02 CourseD        PIC X(28).
        02 Grade          PIC X(1).
        02 CreditHr       PIC 9.
        02 FILLER         PIC X(1).
       FD myOutFile.
       01 studentOutRecord.
        02 DatFile PIC X(10).
       WORKING-STORAGE SECTION.
       01 w PIC X(3) VALUE "YES".
       01 stor PIC X(9).
       PROCEDURE DIVISION. …
Run Code Online (Sandbox Code Playgroud)

cobol gnucobol

1
推荐指数
1
解决办法
55
查看次数