Is there a way to encrypt/lock a File.CreateText file? (its my highscore)

So my high score system is a little weird. I use the File.CreateText thing to do it, here is the script if you need it: (Java and its called ScoreSave)
import System.IO;

var fileName = "hs.data";
var ScoreAmount : int;

var HighScore : int;

function Start (){
    HighScore = ScoreLoad.CompareScore;
    ScoreAmount = GlobalScore.CurrentScore;
    if (ScoreAmount >= HighScore){
        var OurFile = File.CreateText(fileName);
        OurFile.WriteLine (ScoreAmount);
        OurFile.Close();
    }
}

Also here is my script for loading the score if that is needed for explanation (java and its called ScoreLoad):

import System.IO;

var fileName = "HS.data";
var ScoreLoad : String;
var HighScoreDisplay : GameObject;

var line : String;

static var CompareScore : int;

function Start(){
    var sr : StreamReader = new StreamReader(fileName);

    line = sr.ReadLine();
    while (line != null){
        ScoreLoad = line;
        line = sr.ReadLine();

    }
    sr.Close();

    HighScoreDisplay.GetComponent.<Text>().text = "" + ScoreLoad;

    CompareScore = int.Parse(ScoreLoad);
}

My question is how do I make it so in the final build, players wont just be able to go to the game files, go into the file called hs.data and change their high score to a high number aka cheat? How do I like encrypt it or lock it or make it permanently read only or something? Anything helps, thank you!
Also it needs to be able to save the highscore when it gets a new one so would read only not work? Help please. Thanks.

encriptions and keys is a very big question. i guess it would simply depend on the security you need. I wrote a simple encryption for you. its not as secure as some advanced techniques or preshared keys but this should be enough to prevent users from editing or even knowing what they are looking at.

this script i wrote for you changes numbers into letters based on your key.

also it adds two additional numbers for every one number. the new set of three numbers must all add together properly so a user can’t just change any one character or two characters in the encrypted string or you know its been tampered with. Additionally with this script you could incorporate the user’s name into the key so people couldn’t share files. just make sure every letter in the key is unique.

public var score:int;
	public var output:String;
	 var key:String;
	var err:boolean;
	
	function Start(){
		//key represents numbers 0 through 9;
		key = "qwertyuiop";

		// example number
		score=1258746;
		print ("original:" + score);

		output=scramble (score);
		print ("scrambled number: " + output);
		print ("returned:"+unscramble (output));
	}


	 function scramble(sint:int):String{
		var i:int;
		var i2:int;
		var i3:int;

		var s1:String="";
		var s2:String="";
		s1 = sint.ToString();

		i = s1.Length;
	
		while (i>0) {i--;
			int.TryParse(s1.Substring(i,1),i2);	
			i3=UnityEngine.Random.Range(0,i2);
			s2=s2+keyed(i3);
			i3=i2-i3;
			s2=s2+keyed(i3);
			s2=s2+keyed(i2);
		}
		return s2;
	}

	// change number into letter
	function keyed(i:int):String{
		return key.Substring (i, 1);}

	//change letter into number
	function unkey(s:String):int {
		var i2:int=-1;
		var i:int = key.Length;
		while (i>0) {i--;
			if(s==key.Substring(i,1))
				i2=i;
				}
		if(i2==-1){err=true;return 0;}else{return i2;}
		}

	function unscramble(s:String):int{
		var i: int;
		var i2: int;
		var i3: int;
		var i4: int;

		var s2:String ="";
		err = false;
	
				i = s.Length;
				
				while (i>0) {i=i-3;
			if(i<0){err=true;}else{
			i2=unkey(s.Substring(i+2,1));
			i3=unkey(s.Substring(i+1,1));
			i4=unkey(s.Substring(i,1));
			if(i3+i4==i2){s2=s2+i2.ToString();}else{err=true;}
			}}
		if(err){return 0;print ("tampered numbers");}
		else{int.TryParse(s2,i);
				return i;}
	
		}