About File Version sha1 hash

新規投稿

コメント

2件のコメント

  • jcleblanc

    Hi ,

     

    Here's the difference between modified at and content modified at:

    • content_modified_at: The last time the content was modified, which may predate when it was first uploaded to Box (if it was modified locally on another system).
    • modified_at: The last time the content was modified since being uploaded into Box, not taking into account modifications before being uploaded to Box.

    The SHA1 is auto-generated based on the content uploaded into Box, and may be used to compare against a SHA1 of the local file. 

     

    - Jon

    0
    コメントアクション パーマリンク
  • Michael Anthony Alabastro

    /* Cut-and-pasting relevant snippets from what I have. This is how I do it in C#. You may have to google how the SHA1Managed object does it. It returns the same sha1 string as the Box sha1. */

    using SSC = System.Security.Cryptography;
    using SI = System.IO;

    public static string GetSha1HashOfFile(string pathToFile)
    {
        using (SSC.SHA1Managed sha1 = new SSC.SHA1Managed())
        {
            using (SI.FileStream stream = SI.File.OpenRead(pathToFile))
            {
                return GetSha1Hash(sha1, stream);
            }
        }
    }

    public static string GetSha1Hash(SSC.SHA1Managed sha1, SI.Stream stream)
    {
        byte[] hash = sha1.ComputeHash(stream);
        return HashByteArrayToString(hash);
    }

    public static string HashByteArrayToString(byte[] hashByteArray)
    {
        System.Text.StringBuilder sb = new System.Text.StringBuilder(hashByteArray.Length * 2);
        foreach (byte b in hashByteArray)
        {
            // can be "x2" if you want lowercase
            sb.Append(b.ToString("X2"));
        }
        return sb.ToString();
    }

    0
    コメントアクション パーマリンク

サインインしてコメントを残してください。