Grease an 8-inch square baking pan.
In a medium saucepan, combine sugar, cocoa, salt, and milk. Stir over medium heat until mixture boils. Boil for 2 minutes, stirring constantly.
Remove from heat and stir in butter, vanilla, and nuts, if desired.
Pour mixture into prepared pan, spreading evenly. Cool completely before cutting.