Menu  Toggle search  [ ![](https://winscp-
static-746341.c.cdn77.org/assets/images/logos/logo.png?v=7032) WinSCP  Free
SFTP, SCP, S3 and FTP client  for  Windows  ](https://winscp.net/)

  * [ Home ](/eng/index.php)
  * [ News ](/eng/news.php)
  * [ Introduction ](/eng/docs/introduction)
  * [ Download ](/eng/download.php)
  * [ Install ](/eng/docs/guide_install)
  * [ Documentation ](/eng/docs/)
  * [ Forum ](/forum/)

Close

Search

Close

[ Documentation ](/eng/docs/start "Documentation") » [ Features
](/eng/docs/feature_index "Features") » [ Scripting ](/eng/docs/scripting
"Scripting") » [ Script Commands ](/eng/docs/scripting#commands "Script
Commands") »

#  checksum command

Calculates a checksum of a remote file.

  * Syntax 
  * Remarks 
  * Examples 
  * Converting to .NET Assembly 

_Advertisement_

##  Syntax

    
    
    checksum <alg> <file>
    

##  Remarks

` alg ` is a name of a checksum algorithm to use. Use [ IANA name of algorithm
](https://www.iana.org/assignments/hash-function-text-names/hash-function-
text-names.xhtml "https://www.iana.org/assignments/hash-function-text-
names/hash-function-text-names.xhtml") or use a name of any proprietary
algorithm the server supports (with  SFTP  protocol only). Commonly supported
algorithms are ` sha-1 ` and ` md5 ` .

Supported with [ SFTP ](/eng/docs/sftp) and [ FTP ](/eng/docs/ftp) protocols,
subject to support of [ respective protocol extension ](/eng/docs/protocols) .

XML  log element: ` [ checksum ](/eng/docs/logging_xml#checksum) `

##  Examples

    
    
    [checksum](https://winscp.net/eng/docs/scriptcommand_checksum) sha-1 index.html

##  Converting to .NET Assembly

When [ converting script to .NET Assembly ](/eng/docs/library_from_script) ,
map ` checksum ` command to ` [ Session.CalculateFileChecksum
](/eng/docs/library_session_calculatefilechecksum) ` method.

Parameters mapping: Command parameters ` alg ` and ` file ` maps to method
parameters ` algorithm ` and ` path ` , respectively. You have to [ convert
relative paths to absolute paths ](/eng/docs/library_from_script#paths) .

_Advertisement_

For example, the following script snippet:

    
    
    [cd](https://winscp.net/eng/docs/scriptcommand_cd) /home/martinp/public_html
    [checksum](https://winscp.net/eng/docs/scriptcommand_checksum) sha-1 index.html

maps to the following [ PowerShell ](/eng/docs/library_powershell) code:

    
    
    Write-Host ([System.[BitConverter](https://learn.microsoft.com/en-us/dotnet/api/system.bitconverter)]::ToString($session.CalculateFileChecksum("/home/martinp/public_html/index.html")))

##  Contribute

![PayPal](https://winscp-
static-746341.c.cdn77.org/assets/images/paypal.svg?v=7032)

[ Donate ](/eng/donate.php)

  * [ $9 ](/eng/donate.php?amount=9&currency=USD&class=S "Donate $9 via PayPal")
  * [ $19 ](/eng/donate.php?amount=19&currency=USD&class=S "Donate $19 via PayPal")
  * [ $49 ](/eng/donate.php?amount=49&currency=USD&class=S "Donate $49 via PayPal")
  * [ $99 ](/eng/donate.php?amount=99&currency=USD&class=S "Donate $99 via PayPal")

![Visa](https://winscp-static-746341.c.cdn77.org/assets/images/card-logo-
visa.svg?v=7032) ![Mastercard](https://winscp-
static-746341.c.cdn77.org/assets/images/card-logo-mastercard.svg?v=7032)
![American Express](https://winscp-
static-746341.c.cdn77.org/assets/images/card-logo-amex.svg?v=7032)
![Other](https://winscp-static-746341.c.cdn77.org/assets/images/card-logo-
unknown.svg?v=7032)

##  User Approved Software

###  Total Downloads:

214,431,241

###  Rating:

4.8  out of  195  reviews

[ SourceForge Review ](https://sourceforge.net/projects/winscp/reviews/)

##  Recommend

  *   * [ Tweet ](https://twitter.com/share)

_Advertisement_

##  Most Read

  * [ Login Dialog – Configuring Session ](/eng/docs/ui_login)
  * [ Using Commander Interface ](/eng/docs/ui_commander)
  * [ Installing SFTP/SSH Server on Windows using OpenSSH ](/eng/docs/guide_windows_openssh_server)
  * [ Authentication Progress ](/eng/do