Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4245772
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T03:53:04+00:00 2026-05-21T03:53:04+00:00

In my silverlight application I have to generate a hash for a large file(>

  • 0

In my silverlight application I have to generate a hash for a large file(> 2Gb)
The operation is taking a lot of time. My code looks like:

    public static string GetFileHash(FileInfo file)
    {            
        FileStream fs = file.OpenRead();
        SHA256 shaM = new SHA256Managed();
        var result = BitConverter.ToString(shaM.ComputeHash(fs));
        return result;
    }

I think that the problem is the fact that I am not using a buffered stream. In silverlight I did not fount the BufferedStream.

Do you know any efficient implementation of the hash algorithm? I tried md5 … but it is not supported in silverlight.

Thanks a lot,
Radu D

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T03:53:05+00:00Added an answer on May 21, 2026 at 3:53 am

    To hash the file the code has to read the whole file, which will take some time. A modern hard disk may work at about 100 MB/s (faster is possible but much more expensive), so a 2 GB file will take at least 20 seconds.

    SHA-256 is not the fastest of hash functions and managed code in Silverlight is not the fastest implementation technology ever. You could expect, realistically, something like 60 MB/s with a 2.4 GHz Core2 PC (that’s what I get with stand-alone VM from .NET 4.0 on my PC; I could do a bit faster than that — say 75 MB/s — with my own SHA-256 managed implementation). That’s not bad, but still a bit less than the hard disk speed.

    If you happen to run in 64-bit mode, then you may want to try SHA-512, which is faster than SHA-256 on 64-bit architectures (but substantially slower on 32-bit systems). Alternatively, you may want to try using some native code. There are also other hash functions, but some are cryptographically broken (e.g. MD5) so, depending on your situation, you may or may not want to try them. SHA-1 is faster than SHA-256, supported by Silverlight, and cryptographically “weakened” (not fully broken yet, but not as robust as it ought to be), so it is not recommended for new applications if it is used for anything which is related to security. Anyway, you will soon hit the hard disk bandwidth limit, regardless of the hash function you implement.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Silverlight application in which I would like to call a WCF
I have a Silverlight application that generates a lot of Google Maps objects on
I have a Silverlight application that is built from a set of Silverlight class
I have a Silverlight application that communications with an ASP.NET backend through WCF. I
I have a Silverlight application which has on it a Canvas. On that Canvas,
I have a Silverlight 2 application that is consuming a WCF service. As such,
I have a silverlight 2 beta 2 application that accesses a WCF web service.
I have written a WPF application that I want to port to Silverlight 2.
I have a control in Silverlight 2 that changes state during the application. When
I have an MVC application that among other things contains a small Silverlight menu

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.