public string CreateClan(string sClanName, string sClanPassPhrase) { // make sure a clan with this name doesn't already exist TableOperation pClanRetrieveOp = TableOperation.Retrieve <ClanTableEntity>("CLAN", sClanName); if (this.Table.Execute(pClanRetrieveOp).Result != null) { return(Master.MessagifyError("A clan with this name already exists.")); } // if we make it to this point we're good, add the new clan! ClanTableEntity pClan = new ClanTableEntity(sClanName); pClan.PassPhrase = this.Sha256Hash(sClanPassPhrase); this.Table.Execute(TableOperation.Insert(pClan)); return(Master.MessagifySimple("You have successfully created the clan " + sClanName + "!")); }
public bool VerifyClanPassPhrase(string sClanName, string sClanPassPhrase) { if (sClanName == null || sClanPassPhrase == null) { return(false); } // get the requested clan row from the table TableOperation pClanRetrieveOp = TableOperation.Retrieve <ClanTableEntity>("CLAN", sClanName); TableResult pClanRetrieveResult = this.Table.Execute(pClanRetrieveOp); if (pClanRetrieveResult.Result == null) { return(false); } ClanTableEntity pClan = (ClanTableEntity)pClanRetrieveResult.Result; // hash clan passphrase string sClanHash = Security.Sha256Hash(sClanPassPhrase); // check if the passphrase matches return(sClanHash == pClan.PassPhrase); }