Need to be able to convert a password to its hash value using c#

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Done
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      I am trying to come up with a C# code to add users to a mongodb database.
      I have the below code, and need the password to be in a password hash format to insert it into system.users. Can you tell me if there any built-in function in c#, or any other price of code that I can use to convert a password into the hash format before inserting it into system.users?

      var user = new MongoUser("foouser", new PasswordEvidence("foopassword"), true); var database = server.GetDatabase("admin"); var usersCollection = database.GetCollection("system.users");
      var userDocument = new BsonDocument
      {

      { "user", user.Username }

      ,

      { "pwd", user.PasswordHash }

      ,

      { "roles", new BsonArray() }

      ,
      { "otherDBRoles", new BsonDocument("productDB", new BsonArray

      { "readWrite" }

      ) } }; usersCollection.Insert(userDocument);

            Assignee:
            Unassigned
            Reporter:
            Jaya
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: