חזור לתיקייה: גליון 1

Transaction

חיפוש בתיקיה
Ctrl K
לחץ כאן או הקש Ctrl K כדי לחפש בכל התיקיה

    Transaction

    02340124

    מבוא לתכנות מערכות

    רשימות הרצאה לקריאה בשבת

    Transaction

    הופק מתוך תקיית התואר של שקד

    uni-folder.vercel.app

    transaction.h

    הערה (קובץ קוד)

    קובץ זה הוא קובץ קוד מסוג C.

    
    #pragma once
    
    #include <string>
    #include <fstream>
    
    using std::string;
    using std::ofstream;
    
    
    /**
    *
     * Transaction - Defining the new Transaction Type
     *
    */
    struct Transaction {
        unsigned int value;
        string sender;
        string receiver;
    };
    
    
    /**
     * TransactionDumpInfo - Prints the data of the transaction to a given file
     *
     * The data is printed in the following format:
     * Sender Name: <name>
     * Receiver Name: <name>
     * Transaction Value: <value>
     *
     * @param transaction Transaction to print
    */
    void TransactionDumpInfo(const Transaction& transaction, ofstream& file);
    
    
    /**
     * TransactionHashMessage - Hashs the message of the transaction
     *
     * @param transaction Transaction to hash
     *
     * @return The hashed message
    */
    string TransactionHashedMessage(const Transaction& transaction);
    
    
    /**
     * TransactionVerifyHashedMessage - Verifies that a given transaction suits a given hashed message
     *
     * @param transaction Given transaction
     * @param hashedMessage Hashed message to verify
     *
     * @return true if the message given is suitable to this transaction, false otherwise
     *
    */
    bool TransactionVerifyHashedMessage(
            const Transaction& transaction,
            string hashedMessage
    );