Subscribe Us

LightBlog

Thursday, 23 December 2021

December 23, 2021

BATCH SCRIPT TO DELETE TEMP FILES AND CLEAR CACHE

@echo off

@echo clear ram cache , temp files boost computer speed

title This file is cleaning and Removing the temp files

color 0a

tree c:\windows\temp

del /s /f /q c:\windows\temp\*.*

tree c:\windows\prefetch

del /s /f /q c:\windows\prefetch\*.*

tree %userprofile%\appdata\local\temp

del /s /f /q %userprofile%\appdata\local\temp\*.*

%windir%\system32\rundll32.exe advapi32.dll,ProcessIdleTasks

@echo temp and windows memory cache file deleted successfully , press any key to continue....

pause > nul

Tuesday, 14 December 2021

December 14, 2021

Hashing with SHA1 Algorithm in C#


For those who want a "standard" text formatting of the hash, you can use something like the following:
static string Hash(string input)
{
    using (SHA1Managed sha1 = new SHA1Managed())
    {
        var hash = sha1.ComputeHash(Encoding.UTF8.GetBytes(input));
        var sb = new StringBuilder(hash.Length * 2);

        foreach (byte b in hash)
        {
            // can be "x2" if you want lowercase
            sb.Append(b.ToString("X2"));
        }

        return sb.ToString();
    }
}