Skip to content

Instantly share code, notes, and snippets.

@Smart123s
Created May 9, 2022 18:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Smart123s/ca5a3b84f27f4aa5ff2bb3fdf9874f00 to your computer and use it in GitHub Desktop.
Save Smart123s/ca5a3b84f27f4aa5ff2bb3fdf9874f00 to your computer and use it in GitHub Desktop.
Re-calculates and updates the value of `check` in me.pou.app_preferences.xml for the Android game Pou
#!/bin/bash
# Read the value of state from me.pou.app_preferences.xml
state=$(grep -oPm1 '(?<=<string name="state">)[^<]+' me.pou.app_preferences.xml)
# Format state to the hashable string & calculate it's hash
check=$(echo -n "p@v_4"${state//&quot;/\"} | md5sum | awk '{ print $1 }')
# Update the value of check in the me.pou.app_preferences.xml
# Regex from https://stackoverflow.com/a/17333829/9767089
sed -i -r 's/(<string name="check">)[^<]*/<string name="check">'$check'/g' me.pou.app_preferences.xml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment