Identifier::Identifier( const proto::ContactItemType type, const proto::HDPath& path) : ot_super() { CalculateDigest(path_to_data(type, path), DefaultType); }
// static std::string VerificationCredential::VerificationID( const proto::Verification& item) { auto id = Identifier::Factory(); id->CalculateDigest(proto::ProtoAsData<proto::Verification>(item)); return String::Factory(id)->Get(); }
bool OTIdentifier::CalculateDigestInternal(const OTData & dataInput, const OTString & strHashAlgorithm) { // See if they wanted to use the SAMY hash if (strHashAlgorithm.Compare(DefaultHashAlgorithm)) { return CalculateDigest(dataInput); } return false; }
OTIdentifier Context::GetID(const Lock& lock) const { OT_ASSERT(verify_write_lock(lock)); auto contract = IDVersion(lock); auto id = Identifier::Factory(); id->CalculateDigest(proto::ProtoAsData(contract)); return id; }
Identifier* Identifier::contract_contents_to_identifier(const Contract& in) { auto output = new Identifier(); OT_ASSERT(nullptr != output); output->CalculateDigest(String::Factory(in)); return output; }
// This method implements the SAMY hash bool OTIdentifier::CalculateDigest(const OTData & dataInput) { #ifndef ANDROID // SHA256 on Android; no whirlpool until OpenSSL 1.0.0 is added. OTIdentifier idSecondHash; if (idSecondHash.CalculateDigest(dataInput, HashAlgorithm2) && CalculateDigest(dataInput, HashAlgorithm1)) { // At this point, we have successfully generated the WHRLPOOL hash in // idSecondHash, and we've successfully generated the SHA-256 hash in // this object. // Next we XOR them together for the final product. return XOR(idSecondHash); } #else // ANDROID if (CalculateDigest(dataInput, HashAlgorithm1)) // SHA256 only until I add the new OpenSSL 1.0 for Android { return true; } #endif // ANDROID return false; }
OTIdentifier PeerRequest::GetID(const proto::PeerRequest& contract) { auto id = Identifier::Factory(); id->CalculateDigest(proto::ProtoAsData(contract)); return id; }
bool Identifier::CalculateDigest(const OTData& dataInput) { auto dataPtr = static_cast<const unsigned char*>(dataInput.GetPointer()); return CalculateDigest(dataPtr, dataInput.GetSize()); }
bool Identifier::CalculateDigest(const String& strInput) { return CalculateDigest( reinterpret_cast<const unsigned char*>(strInput.Get()), static_cast<size_t>(strInput.GetLength())); }