Algebraic description of G-flux in F-theory: New techniques for F-theory phenomenology