node: provide convenience function for signing hashes with ID

This commit is contained in:
itsmattkc
2021-07-29 13:22:40 -07:00
parent bbd6678ec3
commit df4138e5be
4 changed files with 11 additions and 6 deletions
@@ -335,7 +335,7 @@ void TransformDistortNode::Hash(const QString &output, QCryptographicHash &hash,
if (!matrix.isIdentity()) {
// Add fingerprint
hash.addData(id().toUtf8());
HashAddNodeSignature(hash, output);
hash.addData(reinterpret_cast<const char*>(&matrix), sizeof(matrix));
}
}
+1 -1
View File
@@ -123,7 +123,7 @@ void MergeNode::Hash(const QString &output, QCryptographicHash &hash, const rati
if (!passthrough_base && !passthrough_blend) {
// This merge will actually do something so we add a fingerprint
hash.addData(id().toUtf8());
HashAddNodeSignature(hash, output);
}
if (!passthrough_base) {
+7 -4
View File
@@ -1253,6 +1253,12 @@ bool Node::AreLinked(Node *a, Node *b)
return a->links_.contains(b);
}
void Node::HashAddNodeSignature(QCryptographicHash &hash, const QString &output) const
{
hash.addData(id().toUtf8());
hash.addData(output.toUtf8());
}
void Node::InsertInput(const QString &id, NodeValue::Type type, const QVariant &default_value, Node::InputFlags flags, int index)
{
if (id.isEmpty()) {
@@ -1446,11 +1452,8 @@ void Node::SetLabel(const QString &s)
void Node::Hash(const QString &output, QCryptographicHash &hash, const rational& time, const VideoParams &video_params) const
{
Q_UNUSED(output)
// Add this Node's ID and output being used
hash.addData(id().toUtf8());
hash.addData(output.toUtf8());
HashAddNodeSignature(hash, output);
auto inputs = inputs_for_output(output);
foreach (const QString& input, inputs) {
+2
View File
@@ -852,6 +852,8 @@ protected:
};
void HashAddNodeSignature(QCryptographicHash &hash, const QString &output) const;
void InsertInput(const QString& id, NodeValue::Type type, const QVariant& default_value, InputFlags flags, int index);
void PrependInput(const QString& id, NodeValue::Type type, const QVariant& default_value, InputFlags flags = InputFlags(kInputFlagNormal))