If you only need the password creation part you can call this function (by referencing GleamTech.FileVista.dll):
var passwordForDB = CryptoManager.CreatePassword("password");
Also it's possible to create a public link directly by calling a built-in function.
If you can put your code in the same application (like a new aspx file under FileVista folder), you can use this function from the static DataContext object:
var publicLinkId = ApplicationContext.DataContext.CreatePublicLink(userId, rootFolderId, folder.Path, fileName, nameForUrl, false, forceSave, expirationTime, hitLimit, password);
If not then you can always create an instance of DataContext object and call the same function from a separate application:
//Replace Provider and ConnectionString with values from your FileVista.config
var dataContext = new DataContext("Provider", "ConnectionString");
var publicLinkId = dataContext.CreatePublicLink(userId, rootFolderId, folder.Path, fileName, nameForUrl, false, forceSave, expirationTime, hitLimit, password);