Let us assume you have to set password for user, and this password should be stored in f.e. git. The way how password actually stored in Linux helps with this task a lot.

I mean /etc/shadow file. The only this you have to do is to generate such a string for you and update it with sed

>python -c 'import crypt; print crypt.crypt("test", "$6$random_salt")'
$6$random_salt$BnOQxEG8Gk2rzFYwoWXjr59zLVYzwshvca5oV0PtU8fAfT4a571evgca.E0hLnYNCdfq//zw9YyQN33QtztI10

F.e. with a script like this

bash-4.2$ export record="root:/8Ca1ce4.tORCPhjaFi/QE/VQ046Sd7DXAb...20g/:16855:0:99999:7:::"
bash-4.2$ echo ${record} | sed -e 's@^\(root\):\([0-9/A-Za-z\.$]*\):\(.*\):.*@\1:new_shadow_hash:\3@'
root:new_shadow_hash:16855:0:99999:7::

Where:

s # means replace in form of s/regexp/replacement/
@ # delimiter of our choice to not conflict with any of symbols in expression
^\(root\):\([0-9/A-Za-z\.$]*\):\(.*\):.* # escaped expression see original one next line
^(root):([0-9/A-Za-z\.$]*):(.*):.* # original expression: queries for 3 groups so on
\1:new_shadow_hash:\3 # replacement actually. But contains group 1 and group 2 data